[CMake] Pass -nostdlib if supported
authorJonas Hahnfeld <Hahnfeld@itc.rwth-aachen.de>
Tue, 2 Aug 2016 05:51:09 +0000 (05:51 +0000)
committerJonas Hahnfeld <Hahnfeld@itc.rwth-aachen.de>
Tue, 2 Aug 2016 05:51:09 +0000 (05:51 +0000)
The sanitizers use C++ but don't require linking with the library.

Differential Revision: https://reviews.llvm.org/D23005

llvm-svn: 277419

compiler-rt/CMakeLists.txt
compiler-rt/cmake/config-ix.cmake

index e93785f..1723e60 100644 (file)
@@ -111,6 +111,8 @@ if(COMPILER_RT_ENABLE_WERROR)
 endif()
 
 append_string_if(COMPILER_RT_HAS_STD_CXX11_FLAG -std=c++11 CMAKE_CXX_FLAGS)
+# we don't need to link with the C++ library
+append_string_if(COMPILER_RT_HAS_NOSTDLIB_FLAG -nostdlib CMAKE_CXX_FLAGS)
 
 # Emulate C99 and C++11's __func__ for MSVC prior to 2013 CTP.
 if(NOT COMPILER_RT_HAS_FUNC_SYMBOL)
index 92c3452..ec124a1 100644 (file)
@@ -26,6 +26,7 @@ check_cxx_compiler_flag(-fno-rtti            COMPILER_RT_HAS_FNO_RTTI_FLAG)
 check_cxx_compiler_flag(-ffreestanding       COMPILER_RT_HAS_FFREESTANDING_FLAG)
 check_cxx_compiler_flag("-Werror -fno-function-sections" COMPILER_RT_HAS_FNO_FUNCTION_SECTIONS_FLAG)
 check_cxx_compiler_flag(-std=c++11           COMPILER_RT_HAS_STD_CXX11_FLAG)
+check_cxx_compiler_flag(-nostdlib            COMPILER_RT_HAS_NOSTDLIB_FLAG)
 check_cxx_compiler_flag(-ftls-model=initial-exec COMPILER_RT_HAS_FTLS_MODEL_INITIAL_EXEC)
 check_cxx_compiler_flag(-fno-lto             COMPILER_RT_HAS_FNO_LTO_FLAG)
 check_cxx_compiler_flag("-Werror -msse3" COMPILER_RT_HAS_MSSE3_FLAG)