Skip to content

Commit aa35ea5

Browse files
author
MarcoFalke
committed
Merge #19173: build: turn on --enable-c++17 by --enable-fuzz
0012471 build: turn on --enable-c++17 by --enable-fuzz (Vasil Dimov) Pull request description: Fuzzing code uses C++17 specific code (e.g. std::optional), so it is not possible to compile with --enable-fuzz and without --enable-c++17. Thus, turn on --enable-c++17 whenever --enable-fuzz is used. ACKs for top commit: hebasto: ACK 0012471, tested on Linux Mint 19.3 (x86_64); verified that it fails to compile with `--enable-fuzz` and without `--enable-c++17` on master. Tree-SHA512: 290531ea8d79de3b9251ea4ad21e793478b18150cc0124eea1e50c3a4ed92bab89c3e70ed0aa526906f8723ea952cdba4268f1560ae4be9bd25b9e4f9b97436c
2 parents b55b5b6 + 0012471 commit aa35ea5

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

ci/test/00_setup_env_native_fuzz.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@ export RUN_UNIT_TESTS=false
1414
export RUN_FUNCTIONAL_TESTS=false
1515
export RUN_FUZZ_TESTS=true
1616
export GOAL="install"
17-
export BITCOIN_CONFIG="--enable-fuzz --with-sanitizers=fuzzer,address,undefined --enable-c++17 CC=clang CXX=clang++"
17+
export BITCOIN_CONFIG="--enable-fuzz --with-sanitizers=fuzzer,address,undefined CC=clang CXX=clang++"

ci/test/00_setup_env_native_fuzz_with_valgrind.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@ export RUN_FUNCTIONAL_TESTS=false
1515
export RUN_FUZZ_TESTS=true
1616
export FUZZ_TESTS_CONFIG="--valgrind"
1717
export GOAL="install"
18-
export BITCOIN_CONFIG="--enable-fuzz --with-sanitizers=fuzzer --enable-c++17 CC=clang CXX=clang++"
18+
export BITCOIN_CONFIG="--enable-fuzz --with-sanitizers=fuzzer CC=clang CXX=clang++"

configure.ac

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ AC_ARG_ENABLE([c++17],
6969
[use_cxx17=no])
7070

7171
dnl Require C++11 or C++17 compiler (no GNU extensions)
72-
if test "x$use_cxx17" = xyes; then
72+
if test "x$use_cxx17" = xyes -o "x$enable_fuzz" = xyes ; then
7373
AX_CXX_COMPILE_STDCXX([17], [noext], [mandatory])
7474
else
7575
AX_CXX_COMPILE_STDCXX([11], [noext], [mandatory])

doc/fuzzing.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ To quickly get started fuzzing Bitcoin Core using [libFuzzer](https://llvm.org/d
88
$ git clone https://github.com/bitcoin/bitcoin
99
$ cd bitcoin/
1010
$ ./autogen.sh
11-
$ CC=clang CXX=clang++ ./configure --enable-fuzz --with-sanitizers=address,fuzzer,undefined --enable-c++17
11+
$ CC=clang CXX=clang++ ./configure --enable-fuzz --with-sanitizers=address,fuzzer,undefined
1212
# macOS users: If you have problem with this step then make sure to read "macOS hints for
1313
# libFuzzer" on https://github.com/bitcoin/bitcoin/blob/master/doc/fuzzing.md#macos-hints-for-libfuzzer
1414
$ make
@@ -103,7 +103,7 @@ You may also need to take care of giving the correct path for `clang` and
103103
Full configure that was tested on macOS Catalina with `brew` installed `llvm`:
104104
105105
```sh
106-
./configure --enable-fuzz --with-sanitizers=fuzzer,address,undefined CC=/usr/local/opt/llvm/bin/clang CXX=/usr/local/opt/llvm/bin/clang++ --disable-asm --enable-c++17
106+
./configure --enable-fuzz --with-sanitizers=fuzzer,address,undefined CC=/usr/local/opt/llvm/bin/clang CXX=/usr/local/opt/llvm/bin/clang++ --disable-asm
107107
```
108108
109109
Read the [libFuzzer documentation](https://llvm.org/docs/LibFuzzer.html) for more information. This [libFuzzer tutorial](https://github.com/google/fuzzing/blob/master/tutorial/libFuzzerTutorial.md) might also be of interest.
@@ -121,7 +121,7 @@ $ git clone https://github.com/google/afl
121121
$ make -C afl/
122122
$ make -C afl/llvm_mode/
123123
$ ./autogen.sh
124-
$ CC=$(pwd)/afl/afl-clang-fast CXX=$(pwd)/afl/afl-clang-fast++ ./configure --enable-fuzz --enable-c++17
124+
$ CC=$(pwd)/afl/afl-clang-fast CXX=$(pwd)/afl/afl-clang-fast++ ./configure --enable-fuzz
125125
$ make
126126
# For macOS you may need to ignore x86 compilation checks when running "make". If so,
127127
# try compiling using: AFL_NO_X86=1 make
@@ -148,7 +148,7 @@ $ git clone https://github.com/google/honggfuzz
148148
$ cd honggfuzz/
149149
$ make
150150
$ cd ..
151-
$ CC=$(pwd)/honggfuzz/hfuzz_cc/hfuzz-clang CXX=$(pwd)/honggfuzz/hfuzz_cc/hfuzz-clang++ ./configure --enable-fuzz --with-sanitizers=address,undefined --enable-c++17
151+
$ CC=$(pwd)/honggfuzz/hfuzz_cc/hfuzz-clang CXX=$(pwd)/honggfuzz/hfuzz_cc/hfuzz-clang++ ./configure --enable-fuzz --with-sanitizers=address,undefined
152152
$ make
153153
$ mkdir -p inputs/
154154
$ honggfuzz/honggfuzz -i inputs/ -- src/test/fuzz/process_message

0 commit comments

Comments
 (0)