https://github.com/Teemperor created https://github.com/llvm/llvm-project/pull/99871
When building Clang with LLVM_USE_SANITIZE_COVERAGE=ON, libfuzzer is linked against the Clang fuzz targets to inject the main fuzzing loop. The clang-fuzzer-dictionary, which also resides in the same source tree as the fuzz targets, is also linked with -fsanitize=fuzzer because of this. clang-fuzzer-dictionary is however not an actual fuzz target, but instead just a utilty binary that generates a fuzz dictionary. As it already defines a main function, the main function from libfuzzer causes the build to fail because of the duplicate definitions of main. This patch just uses the fuzzer-no-link flags already used by the other utility binaries in this directory (i.e., the protobuf utils). >From af818aeb37742ca6630aecde968e7102350506a8 Mon Sep 17 00:00:00 2001 From: Raphael Isemann <teempe...@gmail.com> Date: Mon, 22 Jul 2024 14:53:46 +0200 Subject: [PATCH] [clang-fuzzer-dictionary] Fix build failure with libfuzzer When building Clang with LLVM_USE_SANITIZE_COVERAGE=ON, libfuzzer is linked against the Clang fuzz targets to inject the main fuzzing loop. The clang-fuzzer-dictionary, which also resides in the same source tree as the fuzz targets, is also linked with -fsanitize=fuzzer because of this. clang-fuzzer-dictionary is however not an actual fuzz target, but instead just a utilty binary that generates a fuzz dictionary. As it already defines a main function, the main function from libfuzzer causes the build to fail because of the duplicate definitions of main. This patch just uses the fuzzer-no-link flags already used by the other utility binaries in this directory (i.e., the protobuf utils). --- clang/tools/clang-fuzzer/dictionary/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/clang/tools/clang-fuzzer/dictionary/CMakeLists.txt b/clang/tools/clang-fuzzer/dictionary/CMakeLists.txt index ee4aa587ea54d..6b72b98f5e1c4 100644 --- a/clang/tools/clang-fuzzer/dictionary/CMakeLists.txt +++ b/clang/tools/clang-fuzzer/dictionary/CMakeLists.txt @@ -1,3 +1,4 @@ +set(CMAKE_CXX_FLAGS ${CXX_FLAGS_NOFUZZ}) add_clang_executable(clang-fuzzer-dictionary dictionary.c ) _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits