1
0
mirror of https://github.com/weechat/weechat.git synced 2026-06-25 04:16:38 +02:00

tests/fuzz: add link option -fsanitize=fuzzer-no-link when fuzzer sanitizer is used

This commit is contained in:
Sébastien Helleu
2025-05-24 08:27:05 +02:00
parent cf1c4a689d
commit aa6cbf911e
+5 -1
View File
@@ -25,6 +25,10 @@ if(NOT DEFINED ENV{LIB_FUZZING_ENGINE})
set(ENV{LIB_FUZZING_ENGINE} "-fsanitize=address,fuzzer")
endif()
if ("$ENV{LIB_FUZZING_ENGINE}" MATCHES "-fsanitize=.*fuzzer")
set(ENV{LIB_FUZZING_ENGINE} "$ENV{LIB_FUZZING_ENGINE};-fsanitize=fuzzer-no-link")
endif()
remove_definitions(-DHAVE_CONFIG_H)
include_directories(
${PROJECT_BINARY_DIR}
@@ -98,6 +102,6 @@ set(FUZZ_CORE_TARGETS calc eval crypto secure string utf8 util)
foreach(fuzz_target ${FUZZ_CORE_TARGETS})
add_executable(weechat_core_${fuzz_target}_fuzzer core/${fuzz_target}-fuzzer.cc)
target_link_libraries(weechat_core_${fuzz_target}_fuzzer ${FUZZ_TARGET_LINK} coverage_config)
set_target_properties(weechat_core_${fuzz_target}_fuzzer PROPERTIES LINK_FLAGS "$ENV{LIB_FUZZING_ENGINE}")
set_target_properties(weechat_core_${fuzz_target}_fuzzer PROPERTIES LINK_OPTIONS "$ENV{LIB_FUZZING_ENGINE}")
add_dependencies(weechat_core_${fuzz_target}_fuzzer ${FUZZ_TARGET_DEPS})
endforeach()