[compiler-rt] r208695 - [Sanitizer/ASan tests] Automatically detect the presence of libstdc++

Timur Iskhodzhanov timurrrr at google.com
Tue May 13 05:57:50 PDT 2014


Author: timurrrr
Date: Tue May 13 07:57:50 2014
New Revision: 208695

URL: http://llvm.org/viewvc/llvm-project?rev=208695&view=rev
Log:
[Sanitizer/ASan tests] Automatically detect the presence of libstdc++

Modified:
    compiler-rt/trunk/cmake/config-ix.cmake
    compiler-rt/trunk/lib/asan/tests/CMakeLists.txt
    compiler-rt/trunk/lib/sanitizer_common/tests/CMakeLists.txt

Modified: compiler-rt/trunk/cmake/config-ix.cmake
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/cmake/config-ix.cmake?rev=208695&r1=208694&r2=208695&view=diff
==============================================================================
--- compiler-rt/trunk/cmake/config-ix.cmake (original)
+++ compiler-rt/trunk/cmake/config-ix.cmake Tue May 13 07:57:50 2014
@@ -45,6 +45,7 @@ check_cxx_compiler_flag(/wd4722 COMPILER
 check_symbol_exists(__func__ "" COMPILER_RT_HAS_FUNC_SYMBOL)
 
 # Libraries.
+check_library_exists(stdc++ __cxa_pure_virtual "" COMPILER_RT_HAS_LIBSTDCXX)
 check_library_exists(m pow "" COMPILER_RT_HAS_LIBM)
 check_library_exists(dl dlopen "" COMPILER_RT_HAS_LIBDL)
 check_library_exists(pthread pthread_create "" COMPILER_RT_HAS_LIBPTHREAD)

Modified: compiler-rt/trunk/lib/asan/tests/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/tests/CMakeLists.txt?rev=208695&r1=208694&r2=208695&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/tests/CMakeLists.txt (original)
+++ compiler-rt/trunk/lib/asan/tests/CMakeLists.txt Tue May 13 07:57:50 2014
@@ -63,8 +63,10 @@ set(ASAN_UNITTEST_INSTRUMENTED_CFLAGS
 )
 
 # Unit tests require libstdc++ on POSIX.
+append_if(COMPILER_RT_HAS_LIBSTDCXX -lstdc++ ASAN_UNITTEST_COMMON_LINKFLAGS)
+
 if(NOT MSVC)
-  list(APPEND ASAN_UNITTEST_COMMON_LINKFLAGS --driver-mode=g++ -lstdc++)
+  list(APPEND ASAN_UNITTEST_COMMON_LINKFLAGS --driver-mode=g++)
 endif()
 
 # x86_64 FreeBSD 9.2 additionally requires libc++ to build the tests.

Modified: compiler-rt/trunk/lib/sanitizer_common/tests/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/tests/CMakeLists.txt?rev=208695&r1=208694&r2=208695&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/tests/CMakeLists.txt (original)
+++ compiler-rt/trunk/lib/sanitizer_common/tests/CMakeLists.txt Tue May 13 07:57:50 2014
@@ -42,8 +42,7 @@ set(SANITIZER_TEST_CFLAGS_COMMON
   -Werror=sign-compare
   -Wno-non-virtual-dtor)
 
-set(SANITIZER_TEST_LINK_FLAGS_COMMON
-  -lstdc++)
+append_if(COMPILER_RT_HAS_LIBSTDCXX -lstdc++ SANITIZER_TEST_LINK_FLAGS_COMMON)
 append_if(COMPILER_RT_HAS_LIBDL -ldl SANITIZER_TEST_LINK_FLAGS_COMMON)
 append_if(COMPILER_RT_HAS_LIBPTHREAD -lpthread SANITIZER_TEST_LINK_FLAGS_COMMON)
 # x86_64 FreeBSD 9.2 additionally requires libc++ to build the tests.





More information about the llvm-commits mailing list