[PATCH] D14165: [lld] Ensure we link to the threading library used by std::thread (e.g. pthreads).
Daniel Sanders via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 28 17:17:01 PDT 2015
dsanders created this revision.
dsanders added subscribers: atanasyan, llvm-commits.
This fixes the BUILD_SHARED_LIBS=ON build. We must link to the threading
library even when LLVM_ENABLE_THREADS is OFF.
http://reviews.llvm.org/D14165
Files:
CMakeLists.txt
COFF/CMakeLists.txt
lib/Driver/CMakeLists.txt
lib/ReaderWriter/CMakeLists.txt
lib/ReaderWriter/ELF/CMakeLists.txt
lib/ReaderWriter/MachO/CMakeLists.txt
unittests/CMakeLists.txt
Index: unittests/CMakeLists.txt
===================================================================
--- unittests/CMakeLists.txt
+++ unittests/CMakeLists.txt
@@ -7,7 +7,9 @@
# Produces a binary named 'basename(test_dirname)'.
function(add_lld_unittest test_dirname)
add_unittest(LLDUnitTests ${test_dirname} ${ARGN})
- target_link_libraries(${test_dirname} ${LLVM_COMMON_LIBS})
+ target_link_libraries(${test_dirname}
+ ${LLVM_COMMON_LIBS}
+ ${CMAKE_THREAD_LIBS_INIT})
endfunction()
add_subdirectory(CoreTests)
Index: lib/ReaderWriter/MachO/CMakeLists.txt
===================================================================
--- lib/ReaderWriter/MachO/CMakeLists.txt
+++ lib/ReaderWriter/MachO/CMakeLists.txt
@@ -22,6 +22,7 @@
lldYAML
LLVMObject
LLVMSupport
+ ${CMAKE_THREAD_LIBS_INIT}
)
include_directories(.)
Index: lib/ReaderWriter/ELF/CMakeLists.txt
===================================================================
--- lib/ReaderWriter/ELF/CMakeLists.txt
+++ lib/ReaderWriter/ELF/CMakeLists.txt
@@ -17,6 +17,7 @@
lldYAML
LLVMObject
LLVMSupport
+ ${CMAKE_THREAD_LIBS_INIT}
)
include_directories(.)
Index: lib/ReaderWriter/CMakeLists.txt
===================================================================
--- lib/ReaderWriter/CMakeLists.txt
+++ lib/ReaderWriter/CMakeLists.txt
@@ -15,4 +15,5 @@
lldYAML
LLVMObject
LLVMSupport
+ ${CMAKE_THREAD_LIBS_INIT}
)
Index: lib/Driver/CMakeLists.txt
===================================================================
--- lib/Driver/CMakeLists.txt
+++ lib/Driver/CMakeLists.txt
@@ -34,6 +34,7 @@
LLVMObject
LLVMOption
LLVMSupport
+ ${CMAKE_THREAD_LIBS_INIT}
)
add_dependencies(lldDriver DriverOptionsTableGen)
Index: COFF/CMakeLists.txt
===================================================================
--- COFF/CMakeLists.txt
+++ COFF/CMakeLists.txt
@@ -27,6 +27,8 @@
Target
Option
Support
+ LINK_LIBS
+ ${CMAKE_THREAD_LIBS_INIT}
)
add_dependencies(lldCOFF COFFOptionsTableGen)
Index: CMakeLists.txt
===================================================================
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -86,6 +86,10 @@
)
endif()
+# Detect libraries needed to use std::thread. This seems to be necessary for
+# LLVM_ENABLE_THREADS=OFF too.
+find_package(Threads)
+
add_subdirectory(lib)
add_subdirectory(tools)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D14165.38699.patch
Type: text/x-patch
Size: 2444 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151029/8a1b02da/attachment.bin>
More information about the llvm-commits
mailing list