Skip to content

Commit 94a9cd2

Browse files
committed
Merge #20594: Fix getauxval calls in randomenv.cpp
836a3dc Avoid weak-linked getauxval support on non-linux platforms (like macOS) (Jonas Schnelli) 41a413b 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 836a3dc jonatack: utACK 836a3dc Tree-SHA512: 6527f4a617b937f4c368a3cb1c162f1ac38a6f5e6341295554961eaf322906e9b27398a6f7b00819854ceebb5c828d3e6ce0a779edd769adc4053ce8beda3739
2 parents fff7d05 + 836a3dc commit 94a9cd2

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

configure.ac

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1116,18 +1116,20 @@ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
11161116
]], [[
11171117
getauxval(AT_HWCAP);
11181118
]])],
1119-
[ AC_MSG_RESULT(yes); HAVE_STRONG_GETAUXVAL=1 ],
1119+
[ AC_MSG_RESULT(yes); HAVE_STRONG_GETAUXVAL=1; AC_DEFINE(HAVE_STRONG_GETAUXVAL, 1, [Define this symbol to build code that uses getauxval)]) ],
11201120
[ AC_MSG_RESULT(no); HAVE_STRONG_GETAUXVAL=0 ]
11211121
)
11221122

11231123
AC_MSG_CHECKING(for weak getauxval support in the compiler)
11241124
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1125+
#ifdef __linux__
11251126
unsigned long getauxval(unsigned long type) __attribute__((weak));
11261127
#define AT_HWCAP 16
1128+
#endif
11271129
]], [[
11281130
getauxval(AT_HWCAP);
11291131
]])],
1130-
[ AC_MSG_RESULT(yes); HAVE_WEAK_GETAUXVAL=1 ],
1132+
[ 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)]) ],
11311133
[ AC_MSG_RESULT(no); HAVE_WEAK_GETAUXVAL=0 ]
11321134
)
11331135

0 commit comments

Comments
 (0)