[test-suite] r324848 - Use CMAKE_DL_LIBS and CMAKE_THREAD_LIBS_INIT for Bitcode tests
Dimitry Andric via llvm-commits
llvm-commits at lists.llvm.org
Sun Feb 11 12:16:20 PST 2018
Author: dim
Date: Sun Feb 11 12:16:20 2018
New Revision: 324848
URL: http://llvm.org/viewvc/llvm-project?rev=324848&view=rev
Log:
Use CMAKE_DL_LIBS and CMAKE_THREAD_LIBS_INIT for Bitcode tests
Summary:
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 using CMake's `CMAKE_DL_LIBS` instead, which provides the
correct link library names.
While here, also use `CMAKE_THREAD_LIBS_INIT` instead of hardcoding
`-lpthread`.
Reviewers: asbirlea, echristo, emaste, krytarowski, MatzeB, tra
Reviewed By: krytarowski
Subscribers: mgorny, llvm-commits
Differential Revision: https://reviews.llvm.org/D43168
Modified:
test-suite/trunk/Bitcode/Benchmarks/Halide/CMakeLists.txt
test-suite/trunk/Bitcode/Regression/fft/CMakeLists.txt
test-suite/trunk/Bitcode/Regression/vector_widen/CMakeLists.txt
test-suite/trunk/Bitcode/simd_ops/CMakeLists.txt
Modified: test-suite/trunk/Bitcode/Benchmarks/Halide/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/Bitcode/Benchmarks/Halide/CMakeLists.txt?rev=324848&r1=324847&r2=324848&view=diff
==============================================================================
--- test-suite/trunk/Bitcode/Benchmarks/Halide/CMakeLists.txt (original)
+++ test-suite/trunk/Bitcode/Benchmarks/Halide/CMakeLists.txt Sun Feb 11 12:16:20 2018
@@ -1,5 +1,9 @@
if(NOT WIN32)
- list(APPEND LDFLAGS -lpthread -ldl)
+ find_package(Threads)
+ list(APPEND LDFLAGS ${CMAKE_THREAD_LIBS_INIT})
+ foreach(lib ${CMAKE_DL_LIBS})
+ list(APPEND LDFLAGS -l${lib})
+ endforeach()
endif()
if(NOT MSVC)
list(APPEND CXXFLAGS "-std=c++11")
Modified: test-suite/trunk/Bitcode/Regression/fft/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/Bitcode/Regression/fft/CMakeLists.txt?rev=324848&r1=324847&r2=324848&view=diff
==============================================================================
--- test-suite/trunk/Bitcode/Regression/fft/CMakeLists.txt (original)
+++ test-suite/trunk/Bitcode/Regression/fft/CMakeLists.txt Sun Feb 11 12:16:20 2018
@@ -3,7 +3,11 @@ file(GLOB uosources ${CMAKE_CURRENT_SOUR
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)
+find_package(Threads)
+list(APPEND LDFLAGS ${CMAKE_THREAD_LIBS_INIT})
+foreach(lib ${CMAKE_DL_LIBS})
+ list(APPEND LDFLAGS -l${lib})
+endforeach()
set(Source ${CMAKE_CURRENT_SOURCE_DIR}/driver.cpp ${CMAKE_CURRENT_SOURCE_DIR}/x86_17.06.19_halide_runtime.bc ${uosources})
set(PROG fft)
Modified: test-suite/trunk/Bitcode/Regression/vector_widen/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/Bitcode/Regression/vector_widen/CMakeLists.txt?rev=324848&r1=324847&r2=324848&view=diff
==============================================================================
--- test-suite/trunk/Bitcode/Regression/vector_widen/CMakeLists.txt (original)
+++ test-suite/trunk/Bitcode/Regression/vector_widen/CMakeLists.txt Sun Feb 11 12:16:20 2018
@@ -1,7 +1,11 @@
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)
+find_package(Threads)
+list(APPEND LDFLAGS ${CMAKE_THREAD_LIBS_INIT})
+foreach(lib ${CMAKE_DL_LIBS})
+ list(APPEND LDFLAGS -l${lib})
+endforeach()
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)
Modified: test-suite/trunk/Bitcode/simd_ops/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/Bitcode/simd_ops/CMakeLists.txt?rev=324848&r1=324847&r2=324848&view=diff
==============================================================================
--- test-suite/trunk/Bitcode/simd_ops/CMakeLists.txt (original)
+++ test-suite/trunk/Bitcode/simd_ops/CMakeLists.txt Sun Feb 11 12:16:20 2018
@@ -5,7 +5,11 @@ file(GLOB scalar_sources ${CMAKE_CURRENT
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)
+find_package(Threads)
+list(APPEND LDFLAGS ${CMAKE_THREAD_LIBS_INIT})
+foreach(lib ${CMAKE_DL_LIBS})
+ list(APPEND LDFLAGS -l${lib})
+endforeach()
add_library(simd_ops STATIC simd_ops.cpp ${ARCH}_halide_runtime.bc)
target_link_libraries(simd_ops)
test_suite_add_build_dependencies(simd_ops)
More information about the llvm-commits
mailing list