From dd633b9dd12a8a9d7225692c49ebbe175911a6e1 Mon Sep 17 00:00:00 2001 From: Brian Gianforcaro Date: Fri, 7 May 2021 05:25:04 -0700 Subject: [PATCH] Meta: Fix Fuzzers CMakeLists.txt and ReadMe.md to use CXX_COMPILER_ID Previously the directions omitted that you have to specify `-CMAKE_CXX_COMPILER` when building the Fuzzers. This would cause all kinds of weird problems at compilation and link time. You can't specify one or the other, they must both be pointing at clang in order for things to work as experted. Fix this by updating the documentation to specify that the user should specify both the C and CXX compiler explicitly to be safe, as well as forcing the cmake clang argument handling to modify the CXX compiler variable instead of the C version. --- Meta/Lagom/Fuzzers/CMakeLists.txt | 8 ++++---- Meta/Lagom/ReadMe.md | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Meta/Lagom/Fuzzers/CMakeLists.txt b/Meta/Lagom/Fuzzers/CMakeLists.txt index e284a88b51..d0e4a5f82d 100644 --- a/Meta/Lagom/Fuzzers/CMakeLists.txt +++ b/Meta/Lagom/Fuzzers/CMakeLists.txt @@ -6,11 +6,11 @@ function(add_simple_fuzzer name) PUBLIC Lagom) else() target_compile_options(${name} - PRIVATE $<$:-g -O1 -fsanitize=fuzzer> + PRIVATE $<$:-g -O1 -fsanitize=fuzzer> ) target_link_libraries(${name} PUBLIC Lagom - PRIVATE $<$:-fsanitize=fuzzer> + PRIVATE $<$:-fsanitize=fuzzer> ) endif() endfunction() @@ -53,10 +53,10 @@ set(CMAKE_SHARED_LINKER_FLAGS "${ORIGINAL_CMAKE_SHARED_LINKER_FLAGS} -fsanitize= set(CMAKE_MODULE_LINKER_FLAGS "${ORIGINAL_CMAKE_MODULE_LINKER_FLAGS} -fsanitize=address") add_executable(FuzzilliJs FuzzilliJs.cpp) target_compile_options(FuzzilliJs - PRIVATE $<$:-g -O1 -fsanitize-coverage=trace-pc-guard> + PRIVATE $<$:-g -O1 -fsanitize-coverage=trace-pc-guard> ) target_link_libraries(FuzzilliJs PUBLIC Lagom - PRIVATE $<$:-fsanitize-coverage=trace-pc-guard> + PRIVATE $<$:-fsanitize-coverage=trace-pc-guard> ) endif() diff --git a/Meta/Lagom/ReadMe.md b/Meta/Lagom/ReadMe.md index 82558627d4..470eb08930 100644 --- a/Meta/Lagom/ReadMe.md +++ b/Meta/Lagom/ReadMe.md @@ -18,7 +18,7 @@ Lagom can be used to fuzz parts of SerenityOS's code base. This requires buildli # From the root of the SerenityOS checkout: mkdir BuildLagom && cd BuildLagom - cmake -GNinja -DBUILD_LAGOM=ON -DENABLE_FUZZER_SANITIZER=ON -DENABLE_ADDRESS_SANITIZER=ON -DENABLE_UNDEFINED_SANITIZER=ON -DCMAKE_CXX_COMPILER=clang++ .. + cmake -GNinja -DBUILD_LAGOM=ON -DENABLE_FUZZER_SANITIZER=ON -DENABLE_ADDRESS_SANITIZER=ON -DENABLE_UNDEFINED_SANITIZER=ON -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_C_COMPILER=clang .. ninja Meta/Lagom/all # Or as a handy rebuild-rerun line: ninja FuzzJs && Meta/Lagom/Fuzzers/FuzzJs