Accepting request 1224681 from devel:tools:compiler

- 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)

OBS-URL: https://build.opensuse.org/request/show/1224681
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/llvm18?expand=0&rev=11
This commit is contained in:
Ana Guerrero 2024-11-18 18:57:15 +00:00 committed by Git OBS Bridge
commit 6bc9269362
3 changed files with 37 additions and 0 deletions

View File

@ -0,0 +1,26 @@
diff --git a/clang/tools/clang-shlib/CMakeLists.txt b/clang/tools/clang-shlib/CMakeLists.txt
index 298d3a9d18fe..830f2b138ffa 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 AND NOT LLVM_LINKER_IS_SOLARISLD_ILLUMOS)
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: *; };

View File

@ -1,3 +1,11 @@
-------------------------------------------------------------------
Sat Nov 16 22:38:02 UTC 2024 - Aaron Puchert <aaronpuchert@alice-dsl.net>
- 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)
-------------------------------------------------------------------
Mon Nov 11 22:53:32 UTC 2024 - Aaron Puchert <aaronpuchert@alice-dsl.net>

View File

@ -429,6 +429,8 @@ Patch28: llvm-fix-cov-test-i586.patch
Patch29: clang-fix-modules-test-riscv.patch
# PATCH-FIX-UPSTREAM: Test using avx512f requires x86 target.
Patch30: clang-fix-openmp-test-non-x86.patch
# PATCH-FIX-UPSTREAM: Use symbol versioning also for libclang-cpp.so.
Patch31: clang-shlib-symbol-versioning.patch
BuildRequires: binutils-devel >= 2.21.90
BuildRequires: cmake >= 3.13.4
BuildRequires: fdupes
@ -887,6 +889,7 @@ pushd clang-%{_version}.src
%patch -P 27 -p2
%patch -P 29 -p2
%patch -P 30 -p2
%patch -P 31 -p2
# We hardcode openSUSE
rm unittests/Driver/DistroTest.cpp