From 59d503159134de548c3958efb597db545bdef650 Mon Sep 17 00:00:00 2001 From: Petr Hosek Date: Fri, 30 Oct 2020 16:16:09 -0700 Subject: [PATCH] [CMake] Add -fno-rtti into tsan unittests And some other NFC parts of D88922 --- compiler-rt/cmake/config-ix.cmake | 1 + compiler-rt/lib/fuzzer/CMakeLists.txt | 1 + compiler-rt/lib/profile/CMakeLists.txt | 2 +- compiler-rt/lib/tsan/tests/CMakeLists.txt | 5 +++-- compiler-rt/lib/xray/CMakeLists.txt | 1 + 5 files changed, 7 insertions(+), 3 deletions(-) diff --git a/compiler-rt/cmake/config-ix.cmake b/compiler-rt/cmake/config-ix.cmake index 38a1a2b..88a874f 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 b98c271..48bb7fb 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 3457bb6..f899e40 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 61b01a8..5d27e13 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 3798f55..1b738d0 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() -- 2.7.4