summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichal Gorny <mgorny@gentoo.org>2016-10-04 06:09:18 +0000
committerMichal Gorny <mgorny@gentoo.org>2016-10-04 06:09:18 +0000
commit6b929d5ba91eec2acd6f47c6921ce0dff9a94cd6 (patch)
tree723bf0bc81a1ceff6108bee828cc588f04af7e89
parentfd9f63bdba4572f3afc3bc2eac29e064ccf3490b (diff)
downloadbcm5719-llvm-6b929d5ba91eec2acd6f47c6921ce0dff9a94cd6.tar.gz
bcm5719-llvm-6b929d5ba91eec2acd6f47c6921ce0dff9a94cd6.zip
[cmake] Reintroduce (ldconfig-compatible) SOVERSIONs on shared libraries
Reintroduce versioning of shared libraries via SOVERSION, addressing the issues with the previous design, since Gentoo is relying on shared-split install of LLVM. The SOVERSIONs were originally introduced in r229720 for all libraries, and removed in r252093 in favor of custom SONAME. As far as I understand, the major concern with the old versioning was that the used versions were incompatible with ldconfig. Having considered that, this commit introduce SOVERSIONS with the following considerations: 1. SOVERSIONs are formed of major & minor version concatenated -- i.e. for 4.0 its .so.40. This matches the common practice where the first version number indicates ABI breakage, and therefore fixes the issues with ldconfig. Additionally, VERSION with the remaining verion components appended is used, however this is not strictly necessary. 2. The versioning is only applied to libraries with no explicit SONAME specified -- i.e. it won't apply to libLLVM but only to the split libraries. It will also apply to libraries installed by the subprojects. 3. The versioning is only done on *nix systems, Darwin excluded. This matches the current use of SONAME. Differential Revision: https://reviews.llvm.org/D24757 llvm-svn: 283189
-rw-r--r--llvm/cmake/modules/AddLLVM.cmake12
1 files changed, 12 insertions, 0 deletions
diff --git a/llvm/cmake/modules/AddLLVM.cmake b/llvm/cmake/modules/AddLLVM.cmake
index 37b3b801912..7cb1b0cecd4 100644
--- a/llvm/cmake/modules/AddLLVM.cmake
+++ b/llvm/cmake/modules/AddLLVM.cmake
@@ -450,6 +450,18 @@ function(llvm_add_library name)
PREFIX ""
)
endif()
+
+ # Set SOVERSION on shared libraries that lack explicit SONAME
+ # specifier, on *nix systems that are not Darwin.
+ if(UNIX AND NOT APPLE AND NOT ARG_SONAME)
+ set_target_properties(${name}
+ PROPERTIES
+ # Concatenate the version numbers since ldconfig expects exactly
+ # one component indicating the ABI version, while LLVM uses
+ # major+minor for that.
+ SOVERSION ${LLVM_VERSION_MAJOR}${LLVM_VERSION_MINOR}
+ VERSION ${LLVM_VERSION_MAJOR}${LLVM_VERSION_MINOR}.${LLVM_VERSION_PATCH}${LLVM_VERSION_SUFFIX})
+ endif()
endif()
if(ARG_MODULE OR ARG_SHARED)
OpenPOWER on IntegriCloud