[PATCH] D66776: Add GWP-ASan fuzz target to compiler-rt/tools.

Mitch Phillips via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 27 11:40:48 PDT 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rGae56e593b90c: Add GWP-ASan fuzz target to compiler-rt/tools. (authored by hctim).

Changed prior to commit:
  https://reviews.llvm.org/D66776?vs=217274&id=217454#toc

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D66776/new/

https://reviews.llvm.org/D66776

Files:
  compiler-rt/CMakeLists.txt
  compiler-rt/lib/gwp_asan/CMakeLists.txt
  compiler-rt/lib/gwp_asan/stack_trace_compressor_fuzzer.cpp
  compiler-rt/tools/CMakeLists.txt
  compiler-rt/tools/gwp_asan/CMakeLists.txt
  compiler-rt/tools/gwp_asan/stack_trace_compressor_fuzzer.cpp


Index: compiler-rt/tools/gwp_asan/CMakeLists.txt
===================================================================
--- /dev/null
+++ compiler-rt/tools/gwp_asan/CMakeLists.txt
@@ -0,0 +1,20 @@
+# Build the stack trace compressor fuzzer. This will require Clang >= 6.0.0, as
+# -fsanitize=fuzzer-no-link was not a valid command line flag prior to this.
+if (LLVM_USE_SANITIZE_COVERAGE)
+  add_executable(stack_trace_compressor_fuzzer
+      ../../lib/gwp_asan/stack_trace_compressor.cpp
+      ../../lib/gwp_asan/stack_trace_compressor.h
+      stack_trace_compressor_fuzzer.cpp)
+  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)
+  target_include_directories(
+      stack_trace_compressor_fuzzer PRIVATE ../../lib/)
+
+  if (TARGET gwp_asan)
+    add_dependencies(gwp_asan stack_trace_compressor_fuzzer)
+  endif()
+endif()
Index: compiler-rt/tools/CMakeLists.txt
===================================================================
--- /dev/null
+++ compiler-rt/tools/CMakeLists.txt
@@ -0,0 +1 @@
+add_subdirectory(gwp_asan)
Index: compiler-rt/lib/gwp_asan/CMakeLists.txt
===================================================================
--- compiler-rt/lib/gwp_asan/CMakeLists.txt
+++ compiler-rt/lib/gwp_asan/CMakeLists.txt
@@ -98,29 +98,6 @@
       SOURCES optional/backtrace_sanitizer_common.cpp
       ADDITIONAL_HEADERS ${GWP_ASAN_BACKTRACE_HEADERS}
       CFLAGS ${GWP_ASAN_CFLAGS} ${SANITIZER_COMMON_CFLAGS})
-
-  # Build the stack trace compressor fuzzer. Note that clang versions 4.* did
-  # not have -fsanitize=fuzzer, and Clang versions 5.* didn't have
-  # -fsanitize=fuzzer-no-link. In general, the way we build fuzz targets in LLVM
-  # core is to link it against a dummy main when DLLVM_USE_SANITIZE_COVERAGE
-  # isn't specified. Instead, here we only build fuzz targets if clang version
-  # is >= 6.0.
-  if (COMPILER_RT_BUILD_LIBFUZZER AND
-      "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" AND
-      NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 6.0)
-    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(stack_trace_compressor_fuzzer fuzzer)
-    add_dependencies(gwp_asan stack_trace_compressor_fuzzer)
-  endif()
 endif()
 
 if(COMPILER_RT_INCLUDE_TESTS)
Index: compiler-rt/CMakeLists.txt
===================================================================
--- compiler-rt/CMakeLists.txt
+++ compiler-rt/CMakeLists.txt
@@ -513,3 +513,5 @@
     endif()
   endif()
 endif()
+
+add_subdirectory(tools)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D66776.217454.patch
Type: text/x-patch
Size: 3099 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190827/556fe7c1/attachment.bin>


More information about the llvm-commits mailing list