From 25a93c54f3aa1e31da2d04fe0a4c9b7b4de68c7b Mon Sep 17 00:00:00 2001 From: Ivan Krasin Date: Thu, 1 Sep 2016 01:38:32 +0000 Subject: [PATCH] Fix libc++ configuration with -fsanitize-coverage Summary: a recent change (r280015) in libc++ configuration broke LibFuzzer bot: http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-fuzzer/builds/12245 It's not restricted just to that bot; any code that uses the sanitize coverage and configures libc++ hits it. This CL fixes the issue. Reviewers: compnerd Subscribers: aizatsky Differential Revision: https://reviews.llvm.org/D24116 git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@280335 91177308-0d34-0410-b5e6-96231b3b80d8 --- cmake/Modules/CheckLibcxxAtomic.cmake | 3 +++ cmake/config-ix.cmake | 3 +++ 2 files changed, 6 insertions(+) diff --git a/cmake/Modules/CheckLibcxxAtomic.cmake b/cmake/Modules/CheckLibcxxAtomic.cmake index 7d01a9bd1..a7ae667a1 100644 --- a/cmake/Modules/CheckLibcxxAtomic.cmake +++ b/cmake/Modules/CheckLibcxxAtomic.cmake @@ -16,6 +16,9 @@ function(check_cxx_atomics varname) if (CMAKE_C_FLAGS MATCHES -fsanitize OR CMAKE_CXX_FLAGS MATCHES -fsanitize) set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -fno-sanitize=all") endif() + if (CMAKE_C_FLAGS MATCHES -fsanitize-coverage OR CMAKE_CXX_FLAGS MATCHES -fsanitize-coverage) + set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -fno-sanitize-coverage=edge,trace-cmp,indirect-calls,8bit-counters") + endif() check_cxx_source_compiles(" #include #include diff --git a/cmake/config-ix.cmake b/cmake/config-ix.cmake index fa3a07f4f..3f7aff115 100644 --- a/cmake/config-ix.cmake +++ b/cmake/config-ix.cmake @@ -27,6 +27,9 @@ if (LIBCXX_SUPPORTS_NODEFAULTLIBS_FLAG) if (CMAKE_C_FLAGS MATCHES -fsanitize OR CMAKE_CXX_FLAGS MATCHES -fsanitize) set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -fno-sanitize=all") endif () + if (CMAKE_C_FLAGS MATCHES -fsanitize-coverage OR CMAKE_CXX_FLAGS MATCHES -fsanitize-coverage) + set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -fno-sanitize-coverage=edge,trace-cmp,indirect-calls,8bit-counters") + endif () endif () include(CheckLibcxxAtomic)