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
diff --git a/cmake/Modules/CheckLibcxxAtomic.cmake b/cmake/Modules/CheckLibcxxAtomic.cmake
index 7d01a9b..a7ae667 100644
--- a/cmake/Modules/CheckLibcxxAtomic.cmake
+++ b/cmake/Modules/CheckLibcxxAtomic.cmake
@@ -16,6 +16,9 @@
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 <cstdint>
#include <atomic>
diff --git a/cmake/config-ix.cmake b/cmake/config-ix.cmake
index fa3a07f..3f7aff1 100644
--- a/cmake/config-ix.cmake
+++ b/cmake/config-ix.cmake
@@ -27,6 +27,9 @@
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)