From caa716a9915c757d35691b2ed406f5dac4ff7d7d Mon Sep 17 00:00:00 2001 From: Dan Liew Date: Thu, 26 May 2016 20:55:09 +0000 Subject: [PATCH] [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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270913 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Fuzzer/CMakeLists.txt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/Fuzzer/CMakeLists.txt b/lib/Fuzzer/CMakeLists.txt index 6bd1d288be8..e513ac7bbdd 100644 --- a/lib/Fuzzer/CMakeLists.txt +++ b/lib/Fuzzer/CMakeLists.txt @@ -2,6 +2,12 @@ set(LIBFUZZER_FLAGS_BASE "${CMAKE_CXX_FLAGS}") # 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 -- 2.11.0