[PATCH] D28215: Add check for BSD when setting LIB_NAMES for GNU ld

Alex Arslan via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 2 00:02:20 PST 2017


ararslan created this revision.
ararslan added reviewers: chandlerc, axw.
ararslan added a subscriber: llvm-commits.
Herald added subscribers: mgorny, emaste.

FreeBSD (as well as DragonFly BSD) uses GNU ld for linking, but is not captured in the conditional on Linux or MinGW when setting LIB_NAMES. This causes a shared library with no symbols on FreeBSD. This patch simply adds a check for whether the CMake system name is FreeBSD or DragonFly in addition to the existing checks for Linux and MinGW.

This patch is based on that used by the FreeBSD LLVM 3.9 port, revision 426189. The majority of the diff is by Koop Mast (kwm). Alex Arslan (ararslan) updated it for use on the current LLVM trunk.


https://reviews.llvm.org/D28215

Files:
  tools/llvm-shlib/CMakeLists.txt


Index: tools/llvm-shlib/CMakeLists.txt
===================================================================
--- tools/llvm-shlib/CMakeLists.txt
+++ tools/llvm-shlib/CMakeLists.txt
@@ -37,7 +37,7 @@
 add_llvm_library(LLVM SHARED DISABLE_LLVM_LINK_LLVM_DYLIB SONAME ${SOURCES})
 
 list(REMOVE_DUPLICATES LIB_NAMES)
-if("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux" OR MINGW) # FIXME: It should be "GNU ld for elf"
+if(("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux") OR (MINGW) OR ("${CMAKE_SYSTEM_NAME}" STREQUAL "FreeBSD") OR ("${CMAKE_SYSTEM_NAME}" STREQUAL "DragonFly")) # FIXME: It should be "GNU ld for elf"
   # GNU ld doesn't resolve symbols in the version script.
   set(LIB_NAMES -Wl,--whole-archive ${LIB_NAMES} -Wl,--no-whole-archive)
 elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin")


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D28215.82796.patch
Type: text/x-patch
Size: 781 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170102/68d8d017/attachment.bin>


More information about the llvm-commits mailing list