llvm16/clang-shlib-symbol-versioning.patch
Aaron Puchert e16eeb0094 - Apply clang-shlib-symbol-versioning.patch to add symbol versions
to libclang-cpp.so similar to libLLVM.so. This is required when
  multiple versions of the library are loaded into the same
  process. (boo#1219405, boo#1221183, boo#1233220)
- Require libffi when we build openmp for offloading.
- Correct target name for libomptarget in file list.
- Update llvm16.keyring from upstream.

OBS-URL: https://build.opensuse.org/package/show/devel:tools:compiler/llvm16?expand=0&rev=38
2024-11-17 19:58:25 +00:00

27 lines
1.1 KiB
Diff

diff --git a/clang/tools/clang-shlib/CMakeLists.txt b/clang/tools/clang-shlib/CMakeLists.txt
index aa7fcd1efed4..054c7d59ec34 100644
--- a/clang/tools/clang-shlib/CMakeLists.txt
+++ b/clang/tools/clang-shlib/CMakeLists.txt
@@ -48,6 +48,14 @@ add_clang_library(clang-cpp
${_OBJECTS}
LINK_LIBS
${_DEPS})
+
+configure_file(simple_version_script.map.in simple_version_script.map)
+
+if (NOT LLVM_LINKER_IS_SOLARISLD AND NOT MINGW)
+ # Solaris ld does not accept global: *; so there is no way to version *all* global symbols
+ target_link_options(clang-cpp PRIVATE LINKER:--version-script,${CMAKE_CURRENT_BINARY_DIR}/simple_version_script.map)
+endif()
+
# Optimize function calls for default visibility definitions to avoid PLT and
# reduce dynamic relocations.
if (NOT APPLE AND NOT MINGW)
diff --git a/clang/tools/clang-shlib/simple_version_script.map.in b/clang/tools/clang-shlib/simple_version_script.map.in
new file mode 100644
index 000000000000..cb2306d1f596
--- /dev/null
+++ b/clang/tools/clang-shlib/simple_version_script.map.in
@@ -0,0 +1 @@
+@LLVM_SHLIB_SYMBOL_VERSION@ { global: *; };