mirror of
https://github.com/yuzu-emu/unicorn.git
synced 2025-04-01 17:36:51 +00:00
oslib-posix: check for posix_memalign in configure script
Check for the presence of posix_memalign() in the configure script, not using "defined(_POSIX_C_SOURCE) && !defined(__sun__)". This lets qemu use posix_memalign() on NetBSD versions that have it, instead of falling back to valloc() which is wasteful when the required alignment is smaller than a page. Backports commit 9bc5a7193fb422ee53187601eba577ee5d195522 from qemu
This commit is contained in:
parent
6a71ff06ca
commit
53dd82a7ca
qemu
15
qemu/configure
vendored
15
qemu/configure
vendored
|
@ -1196,6 +1196,21 @@ if test "$sanitizers" = "yes" ; then
|
|||
fi
|
||||
fi
|
||||
|
||||
##########################################
|
||||
# check if we have posix_memalign()
|
||||
|
||||
posix_memalign=no
|
||||
cat > $TMPC << EOF
|
||||
#include <stdlib.h>
|
||||
int main(void) {
|
||||
void *p;
|
||||
return posix_memalign(&p, 8, 8);
|
||||
}
|
||||
EOF
|
||||
if compile_prog "" "" ; then
|
||||
posix_memalign=yes
|
||||
fi
|
||||
|
||||
##########################################
|
||||
# End of CC checks
|
||||
# After here, no more $cc or $ld runs
|
||||
|
|
|
@ -84,7 +84,7 @@ void *qemu_try_memalign(size_t alignment, size_t size)
|
|||
alignment = sizeof(void*);
|
||||
}
|
||||
|
||||
#if defined(_POSIX_C_SOURCE) && !defined(__sun__)
|
||||
#if defined(CONFIG_POSIX_MEMALIGN)
|
||||
int ret;
|
||||
ret = posix_memalign(&ptr, alignment, size);
|
||||
if (ret != 0) {
|
||||
|
|
Loading…
Reference in a new issue