[PATCH] D66494: [GWP-ASan] Build stack_trace_compressor_fuzzer.

Mitch Phillips via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 20 13:37:19 PDT 2019


hctim created this revision.
hctim added a reviewer: pcc.
Herald added subscribers: llvm-commits, Sanitizers, mgorny.
Herald added projects: Sanitizers, LLVM.

Flips the switch to build stack_trace_compressor_fuzzer. This was recently
temporarily disabled in rL369079 <https://reviews.llvm.org/rL369079> as it was breaking the sanitizer buildbots.

My diagnosis of the problem is that on clang-only bootstrap builds, we build
gwp_asan before libfuzzer. This causes a discrepancy when the clang driver
attempts to link libclang_rt.fuzzer* as CMake doesn't see a dependency there.

I've (hopefully) fixed the issue by adding a direct dependency for the fuzz
target so CMake can resolve the build order properly. As part of this, the
libFuzzer 'fuzzer' target has to be discovered before the declaration of the
fuzz target.

pcc@ for mild review + notification as buildcop.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D66494

Files:
  compiler-rt/lib/CMakeLists.txt
  compiler-rt/lib/gwp_asan/CMakeLists.txt


Index: compiler-rt/lib/gwp_asan/CMakeLists.txt
===================================================================
--- compiler-rt/lib/gwp_asan/CMakeLists.txt
+++ compiler-rt/lib/gwp_asan/CMakeLists.txt
@@ -100,23 +100,21 @@
       CFLAGS ${GWP_ASAN_CFLAGS} ${SANITIZER_COMMON_CFLAGS})
 
   # Build the stack trace compressor fuzzer.
-  # Currently commented out in order to give me some time to figure out what the
-  # issue is. Rolling back would require rolling back 5 CL's, so this should be
-  # okay until I can get to a real computer and actually fix it tomorrow.
-  # - hctim
-  #if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
-  #  add_executable(stack_trace_compressor_fuzzer
-  #    stack_trace_compressor_fuzzer.cpp
-  #    ${GWP_ASAN_SOURCES}
-  #    ${GWP_ASAN_HEADERS})
-  #  set_target_properties(stack_trace_compressor_fuzzer
-  #    PROPERTIES FOLDER "Fuzzers")
-  #  target_compile_options(stack_trace_compressor_fuzzer
-  #    PRIVATE -fsanitize=fuzzer-no-link)
-  #  set_target_properties(
-  #    stack_trace_compressor_fuzzer PROPERTIES LINK_FLAGS -fsanitize=fuzzer)
-  #  add_dependencies(gwp_asan stack_trace_compressor_fuzzer)
-  #endif()
+  if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" AND
+      COMPILER_RT_BUILD_LIBFUZZER)
+    add_executable(stack_trace_compressor_fuzzer
+        stack_trace_compressor_fuzzer.cpp
+        ${GWP_ASAN_SOURCES}
+        ${GWP_ASAN_HEADERS})
+    set_target_properties(
+        stack_trace_compressor_fuzzer PROPERTIES FOLDER "Fuzzers")
+    target_compile_options(
+        stack_trace_compressor_fuzzer PRIVATE -fsanitize=fuzzer-no-link)
+    set_target_properties(
+        stack_trace_compressor_fuzzer PROPERTIES LINK_FLAGS -fsanitize=fuzzer)
+    add_dependencies(fuzzer stack_trace_compressor_fuzzer)
+    add_dependencies(gwp_asan stack_trace_compressor_fuzzer)
+  endif()
 endif()
 
 if(COMPILER_RT_INCLUDE_TESTS)
Index: compiler-rt/lib/CMakeLists.txt
===================================================================
--- compiler-rt/lib/CMakeLists.txt
+++ compiler-rt/lib/CMakeLists.txt
@@ -34,6 +34,10 @@
   endif()
 endfunction()
 
+if(COMPILER_RT_BUILD_LIBFUZZER)
+  compiler_rt_build_runtime(fuzzer)
+endif()
+
 if(COMPILER_RT_BUILD_SANITIZERS)
   compiler_rt_build_runtime(interception)
 
@@ -55,7 +59,3 @@
 if(COMPILER_RT_BUILD_XRAY)
   compiler_rt_build_runtime(xray)
 endif()
-
-if(COMPILER_RT_BUILD_LIBFUZZER)
-  compiler_rt_build_runtime(fuzzer)
-endif()


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D66494.216232.patch
Type: text/x-patch
Size: 2447 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190820/e1546d56/attachment.bin>


More information about the llvm-commits mailing list