diff --git a/configure.ac b/configure.ac index 0ab45a9822c..8c320b0d6e8 100644 --- a/configure.ac +++ b/configure.ac @@ -696,9 +696,15 @@ if test x$use_glibc_compat != xno; then dnl only wrap fcntl and fctnl64 for 32-bit linux case $host in i?86*linux* | arm*linux*) + AX_CHECK_LINK_FLAG([[-Wl,--wrap=getauxval]], [COMPAT_LDFLAGS="$COMPAT_LDFLAGS -Wl,--wrap=getauxval"]) AX_CHECK_LINK_FLAG([[-Wl,--wrap=fcntl]], [COMPAT_LDFLAGS="$COMPAT_LDFLAGS -Wl,--wrap=fcntl"]) AX_CHECK_LINK_FLAG([[-Wl,--wrap=fcntl64]], [COMPAT_LDFLAGS="$COMPAT_LDFLAGS -Wl,--wrap=fcntl64"]) ;; + x86*linux*) + #if !defined(ENABLE_WALLET) + AX_CHECK_LINK_FLAG([[-Wl,--wrap=getauxval]], [COMPAT_LDFLAGS="$COMPAT_LDFLAGS -Wl,--wrap=getauxval"]) + #endif + ;; esac else AC_SEARCH_LIBS([clock_gettime],[rt]) diff --git a/src/compat/glibc_compat.cpp b/src/compat/glibc_compat.cpp index 6e5148a5c01..f8300e73c4d 100644 --- a/src/compat/glibc_compat.cpp +++ b/src/compat/glibc_compat.cpp @@ -133,6 +133,18 @@ extern "C" int __wrap_clock_gettime(clockid_t a, struct timespec *b) { return clock_gettime_old(a, b); } +extern "C" unsigned long int getauxval_old(unsigned long int type); +#ifdef __i386__ +__asm(".symver getauxval_old,getauxval@GLIBC_2.16"); +#elif defined(__amd64__) +__asm(".symver getauxval_old,getauxval@GLIBC_2.16"); +#elif defined(__arm__) +__asm(".symver getauxval_old,getauxval@GLIBC_2.16"); +#endif +extern "C" int __wrap_getauxval(unsigned long int type) { + return getauxval_old(type); +} + // Wrap fcntl and fcntl64 for 32-bit linux only (both ARM and intel) #if defined(__i386__) || defined(__arm__) extern "C" int fcntl_old(int fd, int cmd, ...);