summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSylvestre Ledru <sylvestre@debian.org>2017-07-19 16:07:51 +0000
committerSylvestre Ledru <sylvestre@debian.org>2017-07-19 16:07:51 +0000
commit2b536542e480caec29f7feca22c41cfa08f19aaa (patch)
treef814792a12ec16f1ed296da4c26339799096208e
parentf76e099ca730e6eb7ffe17b28f1aaf88bdedb34e (diff)
downloadbcm5719-llvm-2b536542e480caec29f7feca22c41cfa08f19aaa.tar.gz
bcm5719-llvm-2b536542e480caec29f7feca22c41cfa08f19aaa.zip
[Solaris] enable --whole-archive for shared-library build, disable --version-script for Solaris-ld
Shared-library build on Solaris requires --whole-archive to be specified (option accepted by all available linkers). At the same time, --version-script can not be handled by Solaris-ld, so it should be skipped. -M is of no use here, since there is no syntax in Solaris-ld mapfiles that allows to version all global symbols, not just the named ones (at least this is my impression from digging deep into the docs). Patch by Fedor Sergeev <fedor.sergeev@oracle.com> llvm-svn: 308490
-rw-r--r--llvm/tools/llvm-shlib/CMakeLists.txt11
1 files changed, 9 insertions, 2 deletions
diff --git a/llvm/tools/llvm-shlib/CMakeLists.txt b/llvm/tools/llvm-shlib/CMakeLists.txt
index 907345a9402..b2109c8758d 100644
--- a/llvm/tools/llvm-shlib/CMakeLists.txt
+++ b/llvm/tools/llvm-shlib/CMakeLists.txt
@@ -37,13 +37,20 @@ endif()
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) OR (HAIKU) OR ("${CMAKE_SYSTEM_NAME}" STREQUAL "FreeBSD") OR ("${CMAKE_SYSTEM_NAME}" STREQUAL "DragonFly")) # FIXME: It should be "GNU ld for elf"
+if(("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux") OR (MINGW) OR (HAIKU)
+ OR ("${CMAKE_SYSTEM_NAME}" STREQUAL "FreeBSD")
+ OR ("${CMAKE_SYSTEM_NAME}" STREQUAL "DragonFly")
+ OR ("${CMAKE_SYSTEM_NAME}" STREQUAL "SunOS")) # FIXME: It should be "GNU ld for elf"
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/simple_version_script.map.in
${LLVM_LIBRARY_DIR}/tools/llvm-shlib/simple_version_script.map)
# GNU ld doesn't resolve symbols in the version script.
- set(LIB_NAMES -Wl,--version-script,${LLVM_LIBRARY_DIR}/tools/llvm-shlib/simple_version_script.map -Wl,--whole-archive ${LIB_NAMES} -Wl,--no-whole-archive)
+ set(LIB_NAMES -Wl,--whole-archive ${LIB_NAMES} -Wl,--no-whole-archive)
+ if (NOT LLVM_LINKER_IS_SOLARISLD)
+ # Solaris ld does not accept global: *; so there is no way to version *all* global symbols
+ set(LIB_NAMES -Wl,--version-script,${LLVM_LIBRARY_DIR}/tools/llvm-shlib/simple_version_script.map ${LIB_NAMES})
+ endif()
elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin")
set(LIB_NAMES -Wl,-all_load ${LIB_NAMES})
endif()
OpenPOWER on IntegriCloud