Merge #20594: Fix getauxval calls in randomenv.cpp

836a3dc02c Avoid weak-linked getauxval support on non-linux platforms (like macOS) (Jonas Schnelli)
41a413b317 Define correct symbols for getauxval (Jonas Schnelli)

Pull request description:

  PR #20358 made use of the two preprocessor symbols `HAVE_STRONG_GETAUXVAL` as well as `HAVE_WEAK_GETAUXVAL`.

  These symbols have not been defined in configure.ac. They where only passed selective as CRC32 CPPFLAGS in https://github.com/bitcoin/bitcoin/blob/master/src/Makefile.crc32c.include#L16.

  PR #20358 would have broken the macOS build since `getauxval` is not supported on macOS (but weak-linking does pass).

  This PR defines the two symbols correctly and reduces calls to `getauxval` to linux.

ACKs for top commit:
  laanwj:
    Code review ACK 836a3dc02c
  jonatack:
    utACK 836a3dc02c

Tree-SHA512: 6527f4a617b937f4c368a3cb1c162f1ac38a6f5e6341295554961eaf322906e9b27398a6f7b00819854ceebb5c828d3e6ce0a779edd769adc4053ce8beda3739
pull/826/head
Wladimir J. van der Laan 4 years ago
commit 94a9cd25fd
No known key found for this signature in database
GPG Key ID: 1E4AED62986CD25D

@ -1116,18 +1116,20 @@ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
]], [[
getauxval(AT_HWCAP);
]])],
[ AC_MSG_RESULT(yes); HAVE_STRONG_GETAUXVAL=1 ],
[ AC_MSG_RESULT(yes); HAVE_STRONG_GETAUXVAL=1; AC_DEFINE(HAVE_STRONG_GETAUXVAL, 1, [Define this symbol to build code that uses getauxval)]) ],
[ AC_MSG_RESULT(no); HAVE_STRONG_GETAUXVAL=0 ]
)
AC_MSG_CHECKING(for weak getauxval support in the compiler)
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#ifdef __linux__
unsigned long getauxval(unsigned long type) __attribute__((weak));
#define AT_HWCAP 16
#endif
]], [[
getauxval(AT_HWCAP);
]])],
[ AC_MSG_RESULT(yes); HAVE_WEAK_GETAUXVAL=1 ],
[ AC_MSG_RESULT(yes); HAVE_WEAK_GETAUXVAL=1; AC_DEFINE(HAVE_WEAK_GETAUXVAL, 1, [Define this symbol to build code that uses getauxval (weak linking)]) ],
[ AC_MSG_RESULT(no); HAVE_WEAK_GETAUXVAL=0 ]
)

Loading…
Cancel
Save