[PATCH] Fix building Asan and common sanitizers tests on FreeBSD 9.2

Viktor Kutuzov vkutuzov at accesssoftek.com
Fri Apr 25 08:26:46 PDT 2014


Hi kcc, samsonov,

We need to add the "-lc++" option explicitly to the LINKFLAGS for some of the Asan and common sanitizers tests (e.g., the -with-calls ones) on FreeBSD 9.2. It looks like it's fixed for upcoming versions of FreeBSD: http://lists.freebsd.org/pipermail/svn-src-stable-9/2012-May/001855.html .

http://reviews.llvm.org/D3512

Files:
  lib/asan/tests/CMakeLists.txt
  lib/sanitizer_common/tests/CMakeLists.txt

Index: lib/asan/tests/CMakeLists.txt
===================================================================
--- lib/asan/tests/CMakeLists.txt
+++ lib/asan/tests/CMakeLists.txt
@@ -50,6 +50,11 @@
 
 # Unit tests require libstdc++.
 set(ASAN_UNITTEST_COMMON_LINKFLAGS -lstdc++)
+# x86_64 FreeBSD 9.2 additionally requires libc++ to build the tests.
+if(CMAKE_SYSTEM MATCHES "FreeBSD-9.2-RELEASE")
+  list(APPEND ASAN_UNITTEST_COMMON_LINKFLAGS "-lc++")
+endif()
+
 # Unit tests on Mac depend on Foundation.
 if(APPLE)
   list(APPEND ASAN_UNITTEST_COMMON_LINKFLAGS -framework Foundation)
Index: lib/sanitizer_common/tests/CMakeLists.txt
===================================================================
--- lib/sanitizer_common/tests/CMakeLists.txt
+++ lib/sanitizer_common/tests/CMakeLists.txt
@@ -45,6 +45,10 @@
   -lstdc++)
 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.
+if(CMAKE_SYSTEM MATCHES "FreeBSD-9.2-RELEASE")
+  list(APPEND SANITIZER_TEST_LINK_FLAGS_COMMON "-lc++")
+endif()
 
 include_directories(..)
 include_directories(../..)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D3512.8848.patch
Type: text/x-patch
Size: 1216 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140425/bd374881/attachment.bin>


More information about the llvm-commits mailing list