[CMake] Add -fno-rtti into tsan unittests
authorPetr Hosek <phosek@google.com>
Fri, 30 Oct 2020 23:16:09 +0000 (16:16 -0700)
committerVitaly Buka <vitalybuka@google.com>
Sat, 31 Oct 2020 03:03:38 +0000 (20:03 -0700)
And some other NFC parts of D88922

compiler-rt/cmake/config-ix.cmake
compiler-rt/lib/fuzzer/CMakeLists.txt
compiler-rt/lib/profile/CMakeLists.txt
compiler-rt/lib/tsan/tests/CMakeLists.txt
compiler-rt/lib/xray/CMakeLists.txt

index 38a1a2b..88a874f 100644 (file)
@@ -123,6 +123,7 @@ check_symbol_exists(__func__ "" COMPILER_RT_HAS_FUNC_SYMBOL)
 
 # Includes.
 check_cxx_compiler_flag(-nostdinc++ COMPILER_RT_HAS_NOSTDINCXX_FLAG)
+check_cxx_compiler_flag(-nostdlib++ COMPILER_RT_HAS_NOSTDLIBXX_FLAG)
 check_include_files("sys/auxv.h"    COMPILER_RT_HAS_AUXV)
 
 # Libraries.
index b98c271..48bb7fb 100644 (file)
@@ -64,6 +64,7 @@ if(OS_NAME MATCHES "Linux|Fuchsia" AND
   # Remove -stdlib= which is unused when passing -nostdinc++.
   string(REGEX REPLACE "-stdlib=[a-zA-Z+]*" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
 elseif(TARGET cxx-headers OR HAVE_LIBCXX)
+  # libFuzzer uses C++ standard library headers.
   set(LIBFUZZER_DEPS cxx-headers)
 endif()
 
index 3457bb6..f899e40 100644 (file)
@@ -113,7 +113,7 @@ endif()
 
 # We don't use the C++ Standard Library here, so avoid including it by mistake.
 append_list_if(COMPILER_RT_HAS_NOSTDINCXX_FLAG -nostdinc++ EXTRA_FLAGS)
-# Remove -stdlib= which is unused when passing -nostdinc++.
+# XRay uses C++ standard library headers.
 string(REGEX REPLACE "-stdlib=[a-zA-Z+]*" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
 
 # This appears to be a C-only warning banning the use of locals in aggregate
index 61b01a8..5d27e13 100644 (file)
@@ -5,13 +5,14 @@ set_target_properties(TsanUnitTests PROPERTIES
   FOLDER "Compiler-RT Tests")
 
 set(TSAN_UNITTEST_CFLAGS
-  ${TSAN_CFLAGS}
   ${COMPILER_RT_UNITTEST_CFLAGS}
   ${COMPILER_RT_GTEST_CFLAGS}
   -I${COMPILER_RT_SOURCE_DIR}/include
   -I${COMPILER_RT_SOURCE_DIR}/lib
   -I${COMPILER_RT_SOURCE_DIR}/lib/tsan/rtl
-  -DGTEST_HAS_RTTI=0)
+  -DGTEST_HAS_RTTI=0
+  -fno-rtti
+)
 
 set(TSAN_TEST_ARCH ${TSAN_SUPPORTED_ARCH})
 
index 3798f55..1b738d0 100644 (file)
@@ -149,6 +149,7 @@ set(XRAY_COMMON_RUNTIME_OBJECT_LIBS
     RTSanitizerCommon
     RTSanitizerCommonLibc)
 
+# XRay uses C++ standard library headers.
 if (TARGET cxx-headers OR HAVE_LIBCXX)
   set(XRAY_DEPS cxx-headers)
 endif()