Skip to content

Commit

Permalink
build: Introduce SANITIZER_CXXFLAGS variable
Browse files Browse the repository at this point in the history
  • Loading branch information
hebasto committed Sep 2, 2024
1 parent 586f988 commit d41f9ca
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 5 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -388,11 +388,15 @@ if(SANITIZERS)
message(FATAL_ERROR "Linker did not accept requested flags, you are missing required libraries.")
endif()
endif()
set(sanitizer_cxxflags_as_string "${SANITIZER_CXXFLAGS}")
separate_arguments(SANITIZER_CXXFLAGS)
target_compile_options(sanitize_interface INTERFACE ${SANITIZER_CXXFLAGS})
target_link_options(sanitize_interface INTERFACE ${SANITIZER_CXXFLAGS})
target_link_options(sanitize_interface INTERFACE ${SANITIZER_LDFLAGS})

if(BUILD_FUZZ_BINARY)
include(CheckSourceCompilesAndLinks)
check_cxx_source_links_with_flags("${SANITIZER_LDFLAGS}" "
check_cxx_source_links_with_flags("${sanitizer_cxxflags_as_string} ${SANITIZER_LDFLAGS}" "
#include <cstdint>
#include <cstddef>
extern \"C\" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { return 0; }
Expand Down
2 changes: 2 additions & 0 deletions ci/test/00_setup_env_native_fuzz_with_msan.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ export BITCOIN_CONFIG="\
-DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_C_FLAGS_DEBUG='' \
-DCMAKE_CXX_FLAGS_DEBUG='' \
-DCMAKE_CXX_FLAGS='' \
-DSANITIZER_CXXFLAGS='${MSAN_AND_LIBCXX_FLAGS}' \
-DBUILD_FOR_FUZZING=ON \
-DSANITIZERS=fuzzer,memory \
-DAPPEND_CPPFLAGS='-DBOOST_MULTI_INDEX_ENABLE_SAFE_MODE -U_FORTIFY_SOURCE' \
Expand Down

0 comments on commit d41f9ca

Please sign in to comment.