summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexey Samsonov <samsonov@google.com>2013-08-29 12:08:36 +0000
committerAlexey Samsonov <samsonov@google.com>2013-08-29 12:08:36 +0000
commit0bc4a0b9c7cae94e4a1d50a77a53cb92781b46c5 (patch)
tree4aaaa535fd65f432df67a1c38aa2928094cbf493
parentd9760ab05f99451ffe7528a3e03e98ab67e09383 (diff)
downloadcompiler-rt-0bc4a0b9c7cae94e4a1d50a77a53cb92781b46c5.tar.gz
compiler-rt-0bc4a0b9c7cae94e4a1d50a77a53cb92781b46c5.tar.bz2
compiler-rt-0bc4a0b9c7cae94e4a1d50a77a53cb92781b46c5.tar.xz
[TSan] Add a couple of compiler warnings to TSan runtime compile flags
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@189581 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--CMakeLists.txt2
-rw-r--r--lib/tsan/CMakeLists.txt14
2 files changed, 11 insertions, 5 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 72b9371d..4a7be9c3 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -167,6 +167,8 @@ check_cxx_compiler_flag(-Wno-non-virtual-dtor SUPPORTS_NO_NON_VIRTUAL_DTOR_FLAG)
if (SUPPORTS_NO_NON_VIRTUAL_DTOR_FLAG)
list(APPEND SANITIZER_COMMON_CFLAGS -Wno-non-virtual-dtor)
endif()
+check_cxx_compiler_flag(-Wglobal-constructors SUPPORTS_GLOBAL_CONSTRUCTORS_FLAG)
+# Not all sanitizers forbid global constructors.
# Setup min Mac OS X version.
if(APPLE)
diff --git a/lib/tsan/CMakeLists.txt b/lib/tsan/CMakeLists.txt
index 7638ec81..fc1944b0 100644
--- a/lib/tsan/CMakeLists.txt
+++ b/lib/tsan/CMakeLists.txt
@@ -8,10 +8,14 @@ set(TSAN_CFLAGS
${SANITIZER_COMMON_CFLAGS}
-fPIE
-fno-rtti)
-# FIXME: Add support for compile flags:
-# -Wframe-larger-than=512,
-# -Wglobal-constructors,
-# --sysroot=.
+
+set(TSAN_RTL_CFLAGS
+ ${TSAN_CFLAGS}
+ -Wframe-larger-than=512)
+if(SUPPORTS_GLOBAL_CONSTRUCTORS_FLAG)
+ list(APPEND TSAN_RTL_CFLAGS -Wglobal-constructors)
+endif()
+# FIXME: Add support for --sysroot=. compile flag:
if("${CMAKE_BUILD_TYPE}" EQUAL "Release")
set(TSAN_COMMON_DEFINITIONS DEBUG=0)
@@ -64,7 +68,7 @@ if(CAN_TARGET_x86_64 AND UNIX AND NOT APPLE)
$<TARGET_OBJECTS:RTInterception.${arch}>
$<TARGET_OBJECTS:RTSanitizerCommon.${arch}>
$<TARGET_OBJECTS:RTSanitizerCommonLibc.${arch}>
- CFLAGS ${TSAN_CFLAGS}
+ CFLAGS ${TSAN_RTL_CFLAGS}
DEFS ${TSAN_COMMON_DEFINITIONS})
add_sanitizer_rt_symbols(clang_rt.tsan-${arch} rtl/tsan.syms.extra)
list(APPEND TSAN_RUNTIME_LIBRARIES clang_rt.tsan-${arch}