[llvm] 76f37d4 - [cmake][NFC] Configuration for libLLVM.so symbol versioning

Stephen Neuendorffer via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 1 23:05:26 PST 2022


Author: Stephen Neuendorffer
Date: 2022-02-01T23:05:03-08:00
New Revision: 76f37d41b751df162aa302b947030682c9ec05db

URL: https://github.com/llvm/llvm-project/commit/76f37d41b751df162aa302b947030682c9ec05db
DIFF: https://github.com/llvm/llvm-project/commit/76f37d41b751df162aa302b947030682c9ec05db.diff

LOG: [cmake][NFC] Configuration for libLLVM.so symbol versioning

Symbol versioning can prevent unintented install-time conflicts
between different llvm versions.  Users may need to override this
for particular products (e.g. Julia), but this requires carrying
a source code patch.  This patch moves this ability to a
configuration option.  NFC for existing usage.

Differential Revision: https://reviews.llvm.org/D118672

Added: 
    

Modified: 
    llvm/CMakeLists.txt
    llvm/tools/llvm-shlib/simple_version_script.map.in

Removed: 
    


################################################################################
diff  --git a/llvm/CMakeLists.txt b/llvm/CMakeLists.txt
index 5596ced09bb80..957f9d96c985a 100644
--- a/llvm/CMakeLists.txt
+++ b/llvm/CMakeLists.txt
@@ -28,6 +28,11 @@ if (NOT PACKAGE_VERSION)
     "${LLVM_VERSION_MAJOR}.${LLVM_VERSION_MINOR}.${LLVM_VERSION_PATCH}${LLVM_VERSION_SUFFIX}")
 endif()
 
+if(NOT DEFINED LLVM_SHLIB_SYMBOL_VERSION)
+  # "Symbol version prefix for libLLVM.so"
+  set(LLVM_SHLIB_SYMBOL_VERSION "LLVM_${LLVM_VERSION_MAJOR}")
+endif()
+
 if ((CMAKE_GENERATOR MATCHES "Visual Studio") AND (MSVC_TOOLSET_VERSION LESS 142) AND (CMAKE_GENERATOR_TOOLSET STREQUAL ""))
   message(WARNING "Visual Studio generators use the x86 host compiler by "
                   "default, even for 64-bit targets. This can result in linker "

diff  --git a/llvm/tools/llvm-shlib/simple_version_script.map.in b/llvm/tools/llvm-shlib/simple_version_script.map.in
index d58a8b3abcd3f..cb2306d1f5968 100644
--- a/llvm/tools/llvm-shlib/simple_version_script.map.in
+++ b/llvm/tools/llvm-shlib/simple_version_script.map.in
@@ -1 +1 @@
-LLVM_ at LLVM_VERSION_MAJOR@ { global: *; };
+ at LLVM_SHLIB_SYMBOL_VERSION@ { global: *; };


        


More information about the llvm-commits mailing list