Bug#848368: llvm-toolchain-3.9: Please add ELF symbols versions to the libraries
Rebecca N. Palmer
rebecca_palmer at zoho.com
Sun Mar 19 10:13:22 UTC 2017
Here's the 'version script' solution, now covering libLLVM, libclang,
liblldb, libLTO, BugpointPasses, LLVMHello and LLVMgold (I suspect only
the first 2-3 actually have use for it, but all except the first are set
from the same place).
Warning: this hasn't been tested either, and the
cmake/modules/AddLLVM.cmake modified here gets shipped in llvm-3.9-dev.
The full list of .so libraries built from llvm-toolchain-3.9:
llvm-3.9-dev:
./usr/lib/llvm-3.9/lib/libLTO.so
-Wl,--version-script,/«PKGBUILDDIR»/build-llvm/tools/lto/LTO.exports
./usr/lib/llvm-3.9/lib/BugpointPasses.so
-Wl,--version-script,/«PKGBUILDDIR»/build-llvm/tools/bugpoint-passes/BugpointPasses.exports
./usr/lib/llvm-3.9/lib/LLVMHello.so
-Wl,--version-script,/«PKGBUILDDIR»/build-llvm/lib/Transforms/Hello/LLVMHello.exports
./usr/lib/llvm-3.9/lib/LLVMPolly.so none, linked from
build-llvm/tools/polly/lib
./usr/lib/llvm-3.9/lib/LLVMgold.so
-Wl,--version-script,/«PKGBUILDDIR»/build-llvm/tools/gold/LLVMgold.exports
libllvm3.9:
./usr/lib/i386-linux-gnu/libLLVM-3.9.so.1
liblldb-3.9:
./usr/lib/llvm-3.9/lib/python2.7/site-packages/readline.so none, linked
from build-llvm/tools/lldb/scripts/Python/modules/readline
./usr/lib/i386-linux-gnu/liblldb-3.9.so.1
-Wl,--version-script,/«PKGBUILDDIR»/build-llvm/tools/lldb/source/API/liblldb.exports
libclang1-3.9:
./usr/lib/i386-linux-gnu/libclang-3.9.so.1
-Wl,--version-script,/«PKGBUILDDIR»/build-llvm/tools/clang/tools/libclang/libclang.exports
libclang-common-3.9-dev:
./usr/lib/llvm-3.9/lib/clang/3.9.1/lib/linux/libclang_rt.dyndd-x86_64.so
(only, though this is from the i386 build log...) none, linked from
build-llvm/projects/compiler-rt/lib/tsan/dd
./usr/lib/llvm-3.9/lib/clang/3.9.1/lib/linux/libclang_rt.asan-x86_64.so
-Wl,--version-script,/«PKGBUILDDIR»/build-llvm/projects/compiler-rt/lib/asan/clang_rt.asan-dynamic-x86_64.vers
./usr/lib/llvm-3.9/lib/clang/3.9.1/lib/linux/libclang_rt.asan-i686.so
none, linked from build-llvm/projects/compiler-rt/lib/asan
./usr/lib/llvm-3.9/lib/clang/3.9.1/lib/linux/libclang_rt.asan-i386.so
none, linked from build-llvm/projects/compiler-rt/lib/asan
-------------- next part --------------
diff -Nru llvm-toolchain-3.9-3.9.1/debian/changelog llvm-toolchain-3.9-3.9.1/debian/changelog
--- llvm-toolchain-3.9-3.9.1/debian/changelog 2017-03-12 09:01:10.000000000 +0000
+++ llvm-toolchain-3.9-3.9.1/debian/changelog 2017-03-19 09:48:56.000000000 +0000
@@ -1,3 +1,11 @@
+llvm-toolchain-3.9 (1:3.9.1-5local2) UNRELEASED; urgency=medium
+
+ * Allow '!pointer' in OpenCL (Closes: #857623)
+ * Add missing liblldb symlink (Closes: #857683)
+ * Use versioned symbols (Closes: #848368)
+
+ -- Rebecca N. Palmer <rebecca_palmer at zoho.com> Sat, 18 Mar 2017 21:29:25 +0000
+
llvm-toolchain-3.9 (1:3.9.1-5) unstable; urgency=medium
* Fix the incorrect symlink to scan-build-py (Closes: #856869)
diff -Nru llvm-toolchain-3.9-3.9.1/debian/liblldb-X.Y.links.in llvm-toolchain-3.9-3.9.1/debian/liblldb-X.Y.links.in
--- llvm-toolchain-3.9-3.9.1/debian/liblldb-X.Y.links.in 2016-08-08 16:02:20.000000000 +0100
+++ llvm-toolchain-3.9-3.9.1/debian/liblldb-X.Y.links.in 2017-03-19 09:47:46.000000000 +0000
@@ -1,3 +1,4 @@
usr/lib/@DEB_HOST_MULTIARCH@/liblldb- at LLVM_VERSION@.so.1 usr/lib/@DEB_HOST_MULTIARCH@/liblldb- at LLVM_VERSION@.so
usr/lib/@DEB_HOST_MULTIARCH@/liblldb- at LLVM_VERSION@.so.1 usr/lib/llvm- at LLVM_VERSION@/lib/liblldb.so.1
+usr/lib/@DEB_HOST_MULTIARCH@/liblldb- at LLVM_VERSION@.so.1 usr/lib/llvm- at LLVM_VERSION@/lib/liblldb- at LLVM_VERSION@.so.1
diff -Nru llvm-toolchain-3.9-3.9.1/debian/patches/857623-allow-opencl-pointer-to-bool.diff llvm-toolchain-3.9-3.9.1/debian/patches/857623-allow-opencl-pointer-to-bool.diff
--- llvm-toolchain-3.9-3.9.1/debian/patches/857623-allow-opencl-pointer-to-bool.diff 1970-01-01 01:00:00.000000000 +0100
+++ llvm-toolchain-3.9-3.9.1/debian/patches/857623-allow-opencl-pointer-to-bool.diff 2017-03-19 09:47:46.000000000 +0000
@@ -0,0 +1,20 @@
+Description: Allow "if (!pointer)" in OpenCL 1.1
+
+Used by e.g. Blender on mesa-opencl-icd
+
+Author: Anastasia Stulova
+Origin: upstream https://reviews.llvm.org/rL294313
+Bug: https://bugs.llvm.org/show_bug.cgi?id=30217
+Bug-Debian: https://bugs.debian.org/857623
+
+--- llvm-toolchain-3.9-3.9.1.orig/clang/lib/Sema/SemaExpr.cpp
++++ llvm-toolchain-3.9-3.9.1/clang/lib/Sema/SemaExpr.cpp
+@@ -11424,7 +11424,7 @@ ExprResult Sema::CreateBuiltinUnaryOp(So
+ Context.getLangOpts().OpenCLVersion < 120) {
+ // OpenCL v1.1 6.3.h: The logical operator not (!) does not
+ // operate on scalar float types.
+- if (!resultType->isIntegerType())
++ if (!resultType->isIntegerType() && !resultType->isPointerType())
+ return ExprError(Diag(OpLoc, diag::err_typecheck_unary_expr)
+ << resultType << Input.get()->getSourceRange());
+ }
diff -Nru llvm-toolchain-3.9-3.9.1/debian/patches/add_symbols_versioning.patch llvm-toolchain-3.9-3.9.1/debian/patches/add_symbols_versioning.patch
--- llvm-toolchain-3.9-3.9.1/debian/patches/add_symbols_versioning.patch 1970-01-01 01:00:00.000000000 +0100
+++ llvm-toolchain-3.9-3.9.1/debian/patches/add_symbols_versioning.patch 2017-03-19 09:46:11.000000000 +0000
@@ -0,0 +1,41 @@
+Description: add a simple linker script to version LLVM symbols
+
+This patch adds a very simple linker script to version the lib's symbols
+and thus trying to avoid crashes if an application loads two different
+LLVM versions (as long as they do not share data between them).
+
+Note that we deliberately *don't* make LLVM_3.9 depend on LLVM_3.8:
+they're incompatible and the whole point of this patch is
+to tell the linker that.
+
+Author: Rebecca N. Palmer <rebecca_palmer at zoho.com>
+Author: Lisandro Damían Nicanor Pérez Meyer <lisandro at debian.org>
+Bug-Debian: https://bugs.debian.org/848368
+
+--- llvm-toolchain-3.9-3.9.1.orig/tools/llvm-shlib/CMakeLists.txt
++++ llvm-toolchain-3.9-3.9.1/tools/llvm-shlib/CMakeLists.txt
+@@ -42,7 +42,7 @@ set_property(TARGET LLVM PROPERTY VERSIO
+ list(REMOVE_DUPLICATES LIB_NAMES)
+ if("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux" OR "${CMAKE_SYSTEM_NAME}" STREQUAL "GNU" OR "${CMAKE_SYSTEM_NAME}" STREQUAL "kFreeBSD") # FIXME: It should be "GNU ld for elf"
+ # GNU ld doesn't resolve symbols in the version script.
+- set(LIB_NAMES -Wl,--whole-archive ${LIB_NAMES} -Wl,--no-whole-archive)
++ set(LIB_NAMES -Wl,--version-script,${CMAKE_CURRENT_SOURCE_DIR}/simple_version_script.map -Wl,--whole-archive ${LIB_NAMES} -Wl,--no-whole-archive)
+ elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin")
+ set(LIB_NAMES -Wl,-all_load ${LIB_NAMES})
+ endif()
+--- /dev/null
++++ llvm-toolchain-3.9-3.9.1/tools/llvm-shlib/simple_version_script.map
+@@ -0,0 +1 @@
++LLVM_3.9 { global: *; };
+--- llvm-toolchain-3.9-3.9.1.orig/cmake/modules/AddLLVM.cmake
++++ llvm-toolchain-3.9-3.9.1/cmake/modules/AddLLVM.cmake
+@@ -74,7 +74,7 @@ function(add_llvm_symbol_exports target_
+ set(native_export_file "${target_name}.exports")
+ # FIXME: Don't write the "local:" line on OpenBSD.
+ add_custom_command(OUTPUT ${native_export_file}
+- COMMAND echo "{" > ${native_export_file}
++ COMMAND echo "LLVM_3.9 {" > ${native_export_file}
+ COMMAND grep -q "[[:alnum:]]" ${export_file} && echo " global:" >> ${native_export_file} || :
+ COMMAND sed -e "s/$/;/" -e "s/^/ /" < ${export_file} >> ${native_export_file}
+ COMMAND echo " local: *;" >> ${native_export_file}
+
diff -Nru llvm-toolchain-3.9-3.9.1/debian/patches/series llvm-toolchain-3.9-3.9.1/debian/patches/series
--- llvm-toolchain-3.9-3.9.1/debian/patches/series 2017-01-27 09:03:47.000000000 +0000
+++ llvm-toolchain-3.9-3.9.1/debian/patches/series 2017-03-19 09:48:15.000000000 +0000
@@ -47,3 +47,5 @@
amdgpu-regression.diff
esan-Fix-ESan-test-failure-on-Debian-Sid-bot.diff
esan-Fix-ESan-test-failure-on-Debian-Sid-bot2.diff
+857623-allow-opencl-pointer-to-bool.diff
+add_symbols_versioning.patch
More information about the Pkg-llvm-team
mailing list