[llvm] r301007 - [libFuzzer] Changing thread_local to __thread in libFuzzer
Kuba Mracek via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 21 10:39:51 PDT 2017
Author: kuba.brecka
Date: Fri Apr 21 12:39:50 2017
New Revision: 301007
URL: http://llvm.org/viewvc/llvm-project?rev=301007&view=rev
Log:
[libFuzzer] Changing thread_local to __thread in libFuzzer
Old Apple compilers do not support thread_local keyword. This patch adds -Dthread_local=__thread when the compiler doesn't support thread_local.
Differential Revision: https://reviews.llvm.org/D32312
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=301007&r1=301006&r2=301007&view=diff
==============================================================================
--- llvm/trunk/lib/Fuzzer/CMakeLists.txt (original)
+++ llvm/trunk/lib/Fuzzer/CMakeLists.txt Fri Apr 21 12:39:50 2017
@@ -1,3 +1,16 @@
+include(CheckCXXSourceCompiles)
+
+CHECK_CXX_SOURCE_COMPILES("
+ static thread_local int blah;
+ int main() {
+ return 0;
+ }
+ " HAS_THREAD_LOCAL)
+
+if( NOT HAS_THREAD_LOCAL )
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Dthread_local=__thread")
+endif()
+
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-coverage=trace-pc-guard,edge,trace-cmp,indirect-calls,8bit-counters -Werror")
More information about the llvm-commits
mailing list