[compiler-rt] 59d5031 - [CMake] Add -fno-rtti into tsan unittests

Vitaly Buka via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 30 20:04:22 PDT 2020


Author: Petr Hosek
Date: 2020-10-30T20:03:38-07:00
New Revision: 59d503159134de548c3958efb597db545bdef650

URL: https://github.com/llvm/llvm-project/commit/59d503159134de548c3958efb597db545bdef650
DIFF: https://github.com/llvm/llvm-project/commit/59d503159134de548c3958efb597db545bdef650.diff

LOG: [CMake] Add -fno-rtti into tsan unittests

And some other NFC parts of D88922

Added: 
    

Modified: 
    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

Removed: 
    


################################################################################
diff  --git a/compiler-rt/cmake/config-ix.cmake b/compiler-rt/cmake/config-ix.cmake
index 38a1a2bdfac5..88a874f20ec2 100644
--- a/compiler-rt/cmake/config-ix.cmake
+++ b/compiler-rt/cmake/config-ix.cmake
@@ -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.

diff  --git a/compiler-rt/lib/fuzzer/CMakeLists.txt b/compiler-rt/lib/fuzzer/CMakeLists.txt
index b98c27145687..48bb7fb956af 100644
--- a/compiler-rt/lib/fuzzer/CMakeLists.txt
+++ b/compiler-rt/lib/fuzzer/CMakeLists.txt
@@ -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()
 

diff  --git a/compiler-rt/lib/profile/CMakeLists.txt b/compiler-rt/lib/profile/CMakeLists.txt
index 3457bb6444de..f899e402d922 100644
--- a/compiler-rt/lib/profile/CMakeLists.txt
+++ b/compiler-rt/lib/profile/CMakeLists.txt
@@ -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

diff  --git a/compiler-rt/lib/tsan/tests/CMakeLists.txt b/compiler-rt/lib/tsan/tests/CMakeLists.txt
index 61b01a8b4da1..5d27e134555a 100644
--- a/compiler-rt/lib/tsan/tests/CMakeLists.txt
+++ b/compiler-rt/lib/tsan/tests/CMakeLists.txt
@@ -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})
 

diff  --git a/compiler-rt/lib/xray/CMakeLists.txt b/compiler-rt/lib/xray/CMakeLists.txt
index 3798f557c42c..1b738d0ff5bf 100644
--- a/compiler-rt/lib/xray/CMakeLists.txt
+++ b/compiler-rt/lib/xray/CMakeLists.txt
@@ -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()


        


More information about the llvm-commits mailing list