[PATCH] D43168: Don't use -ldl on BSD

Dimitry Andric via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Feb 11 07:02:54 PST 2018


dim created this revision.
dim added reviewers: asbirlea, echristo, emaste, krytarowski, MatzeB, tra.
Herald added a subscriber: mgorny.

While testing for the 6.0.0 release candidates, I had many link failures during the build of the test-suite, similar to:

  [ 78%] Linking CXX executable simd_ops_test_op_pmulld_275
  Scanning dependencies of target simd_ops_test_op_vpmulld_390
  /usr/local/bin/ld: cannot find -ldl

This is because some of the Bitcode tests unconditionally add `-ldl` to `LDFLAGS`.  On FreeBSD, NetBSD and OpenBSD there is no libdl, as the required functionality is already built into libc.

Fix it by only adding `-ldl` for non-BSD systems.


Repository:
  rT test-suite

https://reviews.llvm.org/D43168

Files:
  Bitcode/Benchmarks/Halide/CMakeLists.txt
  Bitcode/Regression/fft/CMakeLists.txt
  Bitcode/Regression/vector_widen/CMakeLists.txt
  Bitcode/simd_ops/CMakeLists.txt


Index: Bitcode/simd_ops/CMakeLists.txt
===================================================================
--- Bitcode/simd_ops/CMakeLists.txt
+++ Bitcode/simd_ops/CMakeLists.txt
@@ -5,7 +5,10 @@
 SET_SOURCE_FILES_PROPERTIES(${scalar_sources} PROPERTIES LANGUAGE CXX)
 SET_SOURCE_FILES_PROPERTIES(${CMAKE_CURRENT_SOURCE_DIR}/${ARCH}_halide_runtime.bc PROPERTIES LANGUAGE CXX)
 
-list(APPEND LDFLAGS -lpthread -ldl)
+list(APPEND LDFLAGS -lpthread)
+if(NOT ("${CMAKE_SYSTEM_NAME}" MATCHES "(Free|Net|Open)BSD"))
+  list(APPEND LDFLAGS -ldl)
+endif()
 add_library(simd_ops STATIC simd_ops.cpp ${ARCH}_halide_runtime.bc)
 target_link_libraries(simd_ops)
 test_suite_add_build_dependencies(simd_ops)
Index: Bitcode/Regression/vector_widen/CMakeLists.txt
===================================================================
--- Bitcode/Regression/vector_widen/CMakeLists.txt
+++ Bitcode/Regression/vector_widen/CMakeLists.txt
@@ -1,7 +1,10 @@
 SET_SOURCE_FILES_PROPERTIES(${CMAKE_CURRENT_SOURCE_DIR}/halide_runtime.bc PROPERTIES LANGUAGE CXX)
 SET_SOURCE_FILES_PROPERTIES(${CMAKE_CURRENT_SOURCE_DIR}/vector_widen.bc PROPERTIES LANGUAGE CXX)
 
-list(APPEND LDFLAGS -lpthread -ldl)
+list(APPEND LDFLAGS -lpthread)
+if(NOT ("${CMAKE_SYSTEM_NAME}" MATCHES "(Free|Net|Open)BSD"))
+  list(APPEND LDFLAGS -ldl)
+endif()
 
 set(Source ${CMAKE_CURRENT_SOURCE_DIR}/driver.cpp ${CMAKE_CURRENT_SOURCE_DIR}/halide_runtime.bc ${CMAKE_CURRENT_SOURCE_DIR}/vector_widen.bc)
 set(PROG widen_bug)
Index: Bitcode/Regression/fft/CMakeLists.txt
===================================================================
--- Bitcode/Regression/fft/CMakeLists.txt
+++ Bitcode/Regression/fft/CMakeLists.txt
@@ -3,7 +3,10 @@
 SET_SOURCE_FILES_PROPERTIES(${uosources} PROPERTIES LANGUAGE CXX)
 SET_SOURCE_FILES_PROPERTIES(${CMAKE_CURRENT_SOURCE_DIR}/x86_17.06.19_halide_runtime.bc PROPERTIES LANGUAGE CXX)
 
-list(APPEND LDFLAGS -lpthread -ldl)
+list(APPEND LDFLAGS -lpthread)
+if(NOT ("${CMAKE_SYSTEM_NAME}" MATCHES "(Free|Net|Open)BSD"))
+  list(APPEND LDFLAGS -ldl)
+endif()
 
 set(Source ${CMAKE_CURRENT_SOURCE_DIR}/driver.cpp ${CMAKE_CURRENT_SOURCE_DIR}/x86_17.06.19_halide_runtime.bc ${uosources})
 set(PROG fft)
Index: Bitcode/Benchmarks/Halide/CMakeLists.txt
===================================================================
--- Bitcode/Benchmarks/Halide/CMakeLists.txt
+++ Bitcode/Benchmarks/Halide/CMakeLists.txt
@@ -1,5 +1,8 @@
 if(NOT WIN32)
-  list(APPEND LDFLAGS -lpthread -ldl)
+  list(APPEND LDFLAGS -lpthread)
+  if(NOT ("${CMAKE_SYSTEM_NAME}" MATCHES "(Free|Net|Open)BSD"))
+    list(APPEND LDFLAGS -ldl)
+  endif()
 endif()
 if(NOT MSVC)
   list(APPEND CXXFLAGS "-std=c++11")


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D43168.133789.patch
Type: text/x-patch
Size: 2656 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180211/458d713b/attachment.bin>


More information about the llvm-commits mailing list