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

Alexey Samsonov samsonov at google.com
Tue May 13 11:58:22 PDT 2014


Interesting. Have you checked if --driver-mode=g++ automatically adds
-lstdc++ ? If yes, then I think we should prefer the former flag.


On Tue, May 13, 2014 at 5:57 AM, Timur Iskhodzhanov <timurrrr at google.com>wrote:

> 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.
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>



-- 
Alexey Samsonov, Mountain View, CA
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140513/869dc9a1/attachment.html>


More information about the llvm-commits mailing list