[llvm] r270913 - [LibFuzzer] Emit error if LLVM_USE_SANITIZER is not correctly set.

Dan Liew via llvm-commits llvm-commits at lists.llvm.org
Thu May 26 13:55:09 PDT 2016


Author: delcypher
Date: Thu May 26 15:55:09 2016
New Revision: 270913

URL: http://llvm.org/viewvc/llvm-project?rev=270913&view=rev
Log:
[LibFuzzer] Emit error if LLVM_USE_SANITIZER is not correctly set.

Previously CMake would successfully configure and compile (with warnings
about ``-fsanitize-coverage=...`` being unused) but the tests LibFuzzer
tests would fail.

Differential Revision: http://reviews.llvm.org/D20662

Modified:
    llvm/trunk/lib/Fuzzer/CMakeLists.txt

Modified: llvm/trunk/lib/Fuzzer/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Fuzzer/CMakeLists.txt?rev=270913&r1=270912&r2=270913&view=diff
==============================================================================
--- llvm/trunk/lib/Fuzzer/CMakeLists.txt (original)
+++ llvm/trunk/lib/Fuzzer/CMakeLists.txt Thu May 26 15:55:09 2016
@@ -2,6 +2,12 @@ set(LIBFUZZER_FLAGS_BASE "${CMAKE_CXX_FL
 # Disable the coverage and sanitizer instrumentation for the fuzzer itself.
 set(CMAKE_CXX_FLAGS "${LIBFUZZER_FLAGS_BASE} -fno-sanitize=all -fno-sanitize-coverage=edge,trace-cmp,indirect-calls,8bit-counters -Werror")
 if( LLVM_USE_SANITIZE_COVERAGE )
+  if(NOT "${LLVM_USE_SANITIZER}" STREQUAL "Address")
+    message(FATAL_ERROR
+      "LibFuzzer and its tests require LLVM_USE_SANITIZER=Address and "
+      "LLVM_USE_SANITIZE_COVERAGE=YES to be set."
+      )
+  endif()
   add_library(LLVMFuzzerNoMainObjects OBJECT
     FuzzerCrossOver.cpp
     FuzzerTraceState.cpp




More information about the llvm-commits mailing list