diff options
author | fanquake <fanquake@gmail.com> | 2024-01-26 11:26:52 +0000 |
---|---|---|
committer | fanquake <fanquake@gmail.com> | 2024-01-26 11:31:34 +0000 |
commit | e3b68b3b833984973401ceff43930f7c56a83f29 (patch) | |
tree | 745ad11e9563575c285cd4369e7c279277c5f92d /configure.ac | |
parent | 717103bccec8d271f61f9cd6481b334bd9889146 (diff) | |
parent | cbea49c0d32badb975fbf22d44f8e25cc7972af7 (diff) |
Merge bitcoin/bitcoin#28875: build: Pass sanitize flags to instrument `libsecp256k1` code
cbea49c0d32badb975fbf22d44f8e25cc7972af7 build: Pass sanitize flags to instrument `libsecp256k1` code (Hennadii Stepanov)
Pull request description:
This PR is a revived https://github.com/bitcoin/bitcoin/pull/27991 with an addressed [comment](https://github.com/bitcoin/bitcoin/pull/27991#discussion_r1252148488).
Fixes https://github.com/bitcoin/bitcoin/issues/27990.
Might be tested as follows:
```
$ ./autogen.sh && ./configure --enable-fuzz --with-sanitizers=fuzzer CC=clang-13 CXX=clang++-13
$ make clean > /dev/null && make
$ objdump --disassemble=secp256k1_xonly_pubkey_serialize src/test/fuzz/fuzz | grep __sanitizer_cov
1953bd0:e8 bb c6 05 ff call 9b0290 <__sanitizer_cov_trace_const_cmp8>
1953d32:e8 69 c4 05 ff call 9b01a0 <__sanitizer_cov_trace_pc_indir>
1953d58:e8 43 c4 05 ff call 9b01a0 <__sanitizer_cov_trace_pc_indir>
1953d82:e8 19 c4 05 ff call 9b01a0 <__sanitizer_cov_trace_pc_indir>
```
ACKs for top commit:
fanquake:
ACK cbea49c0d32badb975fbf22d44f8e25cc7972af7
dergoegge:
reACK cbea49c0d32badb975fbf22d44f8e25cc7972af7
Tree-SHA512: 801994e75b711d20eaf0d675f378da07d693f4a7de026efd93860f5f1deabed855a83eca3561725263e4fe605fcc5f91eb73c021ec91c831864e6deb575e3885
Diffstat (limited to 'configure.ac')
-rw-r--r-- | configure.ac | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/configure.ac b/configure.ac index 951dbdbf83..50e6870dd9 100644 --- a/configure.ac +++ b/configure.ac @@ -381,7 +381,8 @@ if test "$use_sanitizers" != ""; then dnl fail if a bad argument is passed, e.g. -fsanitize=undfeined AX_CHECK_COMPILE_FLAG( [-fsanitize=$use_sanitizers], - [SANITIZER_CXXFLAGS="-fsanitize=$use_sanitizers"], + [SANITIZER_CXXFLAGS="-fsanitize=$use_sanitizers" + SANITIZER_CFLAGS="-fsanitize=$use_sanitizers"], [AC_MSG_ERROR([compiler did not accept requested flags])]) dnl Some compilers (e.g. GCC) require additional libraries like libasan, @@ -1931,6 +1932,9 @@ CPPFLAGS_TEMP="$CPPFLAGS" unset CPPFLAGS CPPFLAGS="$CPPFLAGS_TEMP" +if test -n "$use_sanitizers"; then + export SECP_CFLAGS="$SECP_CFLAGS $SANITIZER_CFLAGS" +fi ac_configure_args="${ac_configure_args} --disable-shared --with-pic --enable-benchmark=no --enable-module-recovery --disable-module-ecdh" AC_CONFIG_SUBDIRS([src/secp256k1]) @@ -1990,7 +1994,7 @@ echo " target os = $host_os" echo " build os = $build_os" echo echo " CC = $CC" -echo " CFLAGS = $PTHREAD_CFLAGS $CFLAGS" +echo " CFLAGS = $PTHREAD_CFLAGS $SANITIZER_CFLAGS $CFLAGS" echo " CPPFLAGS = $DEBUG_CPPFLAGS $HARDENED_CPPFLAGS $CORE_CPPFLAGS $CPPFLAGS" echo " CXX = $CXX" echo " CXXFLAGS = $CORE_CXXFLAGS $DEBUG_CXXFLAGS $HARDENED_CXXFLAGS $WARN_CXXFLAGS $NOWARN_CXXFLAGS $ERROR_CXXFLAGS $GPROF_CXXFLAGS $SANITIZER_CXXFLAGS $CXXFLAGS" |