[PATCH] Do not append -ldl for sanitizers' tests on FreeBSD

Viktor Kutuzov vkutuzov at accesssoftek.com
Tue Mar 4 04:55:28 PST 2014


Hi kcc, samsonov,

http://llvm-reviews.chandlerc.com/D2934

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

Index: lib/asan/tests/CMakeLists.txt
===================================================================
--- lib/asan/tests/CMakeLists.txt
+++ lib/asan/tests/CMakeLists.txt
@@ -70,7 +70,13 @@
 
 set(ASAN_UNITTEST_NOINST_LINKFLAGS
   ${ASAN_UNITTEST_COMMON_LINKFLAGS}
-  -ldl -lm)
+  -lm)
+
+# There's no libdl on FreeBSD.
+if(NOT CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
+  list(APPEND ASAN_UNITTEST_NOINST_LINKFLAGS -ldl)
+endif()
+
 if(NOT ANDROID)
   list(APPEND ASAN_UNITTEST_NOINST_LINKFLAGS -lpthread)
 endif()
Index: lib/sanitizer_common/tests/CMakeLists.txt
===================================================================
--- lib/sanitizer_common/tests/CMakeLists.txt
+++ lib/sanitizer_common/tests/CMakeLists.txt
@@ -41,7 +41,12 @@
   -Wall -Werror -Werror=sign-compare)
 
 set(SANITIZER_TEST_LINK_FLAGS_COMMON
-  -lstdc++ -ldl)
+  -lstdc++)
+
+# There's no libdl on FreeBSD.
+if(NOT CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
+  list(APPEND SANITIZER_TEST_LINK_FLAGS_COMMON -ldl)
+endif()
 
 include_directories(..)
 include_directories(../..)
Index: lib/msan/tests/CMakeLists.txt
===================================================================
--- lib/msan/tests/CMakeLists.txt
+++ lib/msan/tests/CMakeLists.txt
@@ -61,10 +61,15 @@
 )
 set(MSAN_UNITTEST_LINK_FLAGS
   -fsanitize=memory
-  -ldl
   # FIXME: we build libcxx without cxxabi and need libstdc++ to provide it.
   -lstdc++
 )
+
+# There's no libdl on FreeBSD.
+if(NOT CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
+  list(APPEND MSAN_UNITTEST_LINK_FLAGS -ldl)
+endif()
+
 set(MSAN_LOADABLE_LINK_FLAGS
   -fsanitize=memory
   -shared
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D2934.1.patch
Type: text/x-patch
Size: 1593 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140304/abea3d06/attachment.bin>


More information about the llvm-commits mailing list