[llvm-branch-commits] [test-suite] r324873 - Merging r324848:

Hans Wennborg via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Mon Feb 12 01:58:37 PST 2018


Author: hans
Date: Mon Feb 12 01:58:36 2018
New Revision: 324873

URL: http://llvm.org/viewvc/llvm-project?rev=324873&view=rev
Log:
Merging r324848:
------------------------------------------------------------------------
r324848 | dim | 2018-02-11 21:16:20 +0100 (Sun, 11 Feb 2018) | 30 lines

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/branches/release_60/   (props changed)
    test-suite/branches/release_60/Bitcode/Benchmarks/Halide/CMakeLists.txt
    test-suite/branches/release_60/Bitcode/Regression/fft/CMakeLists.txt
    test-suite/branches/release_60/Bitcode/Regression/vector_widen/CMakeLists.txt
    test-suite/branches/release_60/Bitcode/simd_ops/CMakeLists.txt

Propchange: test-suite/branches/release_60/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Feb 12 01:58:36 2018
@@ -0,0 +1 @@
+/test-suite/trunk:324848

Modified: test-suite/branches/release_60/Bitcode/Benchmarks/Halide/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/test-suite/branches/release_60/Bitcode/Benchmarks/Halide/CMakeLists.txt?rev=324873&r1=324872&r2=324873&view=diff
==============================================================================
--- test-suite/branches/release_60/Bitcode/Benchmarks/Halide/CMakeLists.txt (original)
+++ test-suite/branches/release_60/Bitcode/Benchmarks/Halide/CMakeLists.txt Mon Feb 12 01:58:36 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/branches/release_60/Bitcode/Regression/fft/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/test-suite/branches/release_60/Bitcode/Regression/fft/CMakeLists.txt?rev=324873&r1=324872&r2=324873&view=diff
==============================================================================
--- test-suite/branches/release_60/Bitcode/Regression/fft/CMakeLists.txt (original)
+++ test-suite/branches/release_60/Bitcode/Regression/fft/CMakeLists.txt Mon Feb 12 01:58:36 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/branches/release_60/Bitcode/Regression/vector_widen/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/test-suite/branches/release_60/Bitcode/Regression/vector_widen/CMakeLists.txt?rev=324873&r1=324872&r2=324873&view=diff
==============================================================================
--- test-suite/branches/release_60/Bitcode/Regression/vector_widen/CMakeLists.txt (original)
+++ test-suite/branches/release_60/Bitcode/Regression/vector_widen/CMakeLists.txt Mon Feb 12 01:58:36 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/branches/release_60/Bitcode/simd_ops/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/test-suite/branches/release_60/Bitcode/simd_ops/CMakeLists.txt?rev=324873&r1=324872&r2=324873&view=diff
==============================================================================
--- test-suite/branches/release_60/Bitcode/simd_ops/CMakeLists.txt (original)
+++ test-suite/branches/release_60/Bitcode/simd_ops/CMakeLists.txt Mon Feb 12 01:58:36 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-branch-commits mailing list