Skip to content

Commit

Permalink
Link fuzzers as C++
Browse files Browse the repository at this point in the history
Building for the libfuzzer, afl and honggfuzz engines works fine when linked as C, but the
centipede fuzzer runs into link errors because it needs the C++ standard library.

Signed-off-by: Erik Boasson <[email protected]>
  • Loading branch information
eboasson committed Mar 22, 2024
1 parent a4937a9 commit 630852f
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions fuzz/fuzz_config_init/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,6 @@ target_include_directories(
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../../src/core/cdr/include>"
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../../src/core/ddsi/include>"
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../../src/core/ddsi/src>")

set_target_properties(fuzz_config_init PROPERTIES LINKER_LANGUAGE CXX)
target_link_libraries(fuzz_config_init CycloneDDS::ddsc $ENV{LIB_FUZZING_ENGINE})
2 changes: 2 additions & 0 deletions fuzz/fuzz_handle_rtps_message/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,6 @@ target_include_directories(
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../../src/core/cdr/include>"
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../../src/core/ddsi/src>"
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../../src/core/ddsi/include>")

set_target_properties(fuzz_handle_rtps_message PROPERTIES LINKER_LANGUAGE CXX)
target_link_libraries(fuzz_handle_rtps_message CycloneDDS::ddsc $ENV{LIB_FUZZING_ENGINE})
1 change: 1 addition & 0 deletions fuzz/fuzz_sample_deser/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,5 @@ target_include_directories(
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../../src/core/ddsi/src>")

target_compile_options(fuzz_sample_deser PRIVATE -fsanitize=fuzzer,address -g)
set_target_properties(fuzz_sample_deser PROPERTIES LINKER_LANGUAGE CXX)
target_link_libraries(fuzz_sample_deser fuzz_sample CycloneDDS::ddsc -fsanitize=fuzzer,address)
2 changes: 2 additions & 0 deletions fuzz/fuzz_type_object/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,6 @@ target_include_directories(
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../../src/core/cdr/include>"
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../../src/core/ddsi/src>"
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../../src/core/ddsi/include>")

set_target_properties(fuzz_type_object PROPERTIES LINKER_LANGUAGE CXX)
target_link_libraries(fuzz_type_object CycloneDDS::ddsc $ENV{LIB_FUZZING_ENGINE})

0 comments on commit 630852f

Please sign in to comment.