Android build fix proposal.

These are detected at configure time while they are glibc
specifics. the bionic equivalent is not api compatible
and dlopen is restricted in this platform.
This commit is contained in:
David Carlier 2020-04-23 20:23:04 +01:00 committed by David Goldblatt
parent d2d941017b
commit 27ef02ca9a

View File

@ -661,10 +661,11 @@ case "${host}" in
*-*-bitrig*) *-*-bitrig*)
abi="elf" abi="elf"
;; ;;
*-*-linux-android) *-*-linux-android*)
dnl syscall(2) and secure_getenv(3) are exposed by _GNU_SOURCE. dnl syscall(2) and secure_getenv(3) are exposed by _GNU_SOURCE.
JE_APPEND_VS(CPPFLAGS, -D_GNU_SOURCE) JE_APPEND_VS(CPPFLAGS, -D_GNU_SOURCE)
abi="elf" abi="elf"
glibc="0"
AC_DEFINE([JEMALLOC_PURGE_MADVISE_DONTNEED_ZEROS], [ ]) AC_DEFINE([JEMALLOC_PURGE_MADVISE_DONTNEED_ZEROS], [ ])
AC_DEFINE([JEMALLOC_HAS_ALLOCA_H]) AC_DEFINE([JEMALLOC_HAS_ALLOCA_H])
AC_DEFINE([JEMALLOC_PROC_SYS_VM_OVERCOMMIT_MEMORY], [ ]) AC_DEFINE([JEMALLOC_PROC_SYS_VM_OVERCOMMIT_MEMORY], [ ])
@ -679,6 +680,7 @@ case "${host}" in
dnl syscall(2) and secure_getenv(3) are exposed by _GNU_SOURCE. dnl syscall(2) and secure_getenv(3) are exposed by _GNU_SOURCE.
JE_APPEND_VS(CPPFLAGS, -D_GNU_SOURCE) JE_APPEND_VS(CPPFLAGS, -D_GNU_SOURCE)
abi="elf" abi="elf"
glibc="1"
AC_DEFINE([JEMALLOC_PURGE_MADVISE_DONTNEED_ZEROS], [ ]) AC_DEFINE([JEMALLOC_PURGE_MADVISE_DONTNEED_ZEROS], [ ])
AC_DEFINE([JEMALLOC_HAS_ALLOCA_H]) AC_DEFINE([JEMALLOC_HAS_ALLOCA_H])
AC_DEFINE([JEMALLOC_PROC_SYS_VM_OVERCOMMIT_MEMORY], [ ]) AC_DEFINE([JEMALLOC_PROC_SYS_VM_OVERCOMMIT_MEMORY], [ ])
@ -2258,38 +2260,40 @@ fi
dnl ============================================================================ dnl ============================================================================
dnl Check for glibc malloc hooks dnl Check for glibc malloc hooks
JE_COMPILABLE([glibc malloc hook], [ if test "x$glibc" = "x1" ; then
#include <stddef.h> JE_COMPILABLE([glibc malloc hook], [
#include <stddef.h>
extern void (* __free_hook)(void *ptr); extern void (* __free_hook)(void *ptr);
extern void *(* __malloc_hook)(size_t size); extern void *(* __malloc_hook)(size_t size);
extern void *(* __realloc_hook)(void *ptr, size_t size); extern void *(* __realloc_hook)(void *ptr, size_t size);
], [ ], [
void *ptr = 0L; void *ptr = 0L;
if (__malloc_hook) ptr = __malloc_hook(1); if (__malloc_hook) ptr = __malloc_hook(1);
if (__realloc_hook) ptr = __realloc_hook(ptr, 2); if (__realloc_hook) ptr = __realloc_hook(ptr, 2);
if (__free_hook && ptr) __free_hook(ptr); if (__free_hook && ptr) __free_hook(ptr);
], [je_cv_glibc_malloc_hook]) ], [je_cv_glibc_malloc_hook])
if test "x${je_cv_glibc_malloc_hook}" = "xyes" ; then if test "x${je_cv_glibc_malloc_hook}" = "xyes" ; then
if test "x${JEMALLOC_PREFIX}" = "x" ; then if test "x${JEMALLOC_PREFIX}" = "x" ; then
AC_DEFINE([JEMALLOC_GLIBC_MALLOC_HOOK], [ ]) AC_DEFINE([JEMALLOC_GLIBC_MALLOC_HOOK], [ ])
wrap_syms="${wrap_syms} __free_hook __malloc_hook __realloc_hook" wrap_syms="${wrap_syms} __free_hook __malloc_hook __realloc_hook"
fi fi
fi fi
JE_COMPILABLE([glibc memalign hook], [ JE_COMPILABLE([glibc memalign hook], [
#include <stddef.h> #include <stddef.h>
extern void *(* __memalign_hook)(size_t alignment, size_t size); extern void *(* __memalign_hook)(size_t alignment, size_t size);
], [ ], [
void *ptr = 0L; void *ptr = 0L;
if (__memalign_hook) ptr = __memalign_hook(16, 7); if (__memalign_hook) ptr = __memalign_hook(16, 7);
], [je_cv_glibc_memalign_hook]) ], [je_cv_glibc_memalign_hook])
if test "x${je_cv_glibc_memalign_hook}" = "xyes" ; then if test "x${je_cv_glibc_memalign_hook}" = "xyes" ; then
if test "x${JEMALLOC_PREFIX}" = "x" ; then if test "x${JEMALLOC_PREFIX}" = "x" ; then
AC_DEFINE([JEMALLOC_GLIBC_MEMALIGN_HOOK], [ ]) AC_DEFINE([JEMALLOC_GLIBC_MEMALIGN_HOOK], [ ])
wrap_syms="${wrap_syms} __memalign_hook" wrap_syms="${wrap_syms} __memalign_hook"
fi fi
fi
fi fi
JE_COMPILABLE([pthreads adaptive mutexes], [ JE_COMPILABLE([pthreads adaptive mutexes], [