Can this be fixed in time for Ubuntu 17.04? Their mesa is built against LLVM 4.0, so if this bug isn't fixed, I (as beignet maintainer) have to choose between "apply a very new 4.0-support patch that might or might not work" and "leave beignet on 3.9, making OpenCL+OpenGL applications (e.g. blender) subject to this bug".

I've been told that there is a command line to add a version to all symbols
without a script, that should be enough at least for Debian packaging.
-Wl,--default-symver : rarely used (only 5 packages), and forces the symbol version to be the soname (i.e. libLLVM-3.9.so.1) rather than the conventional LLVM_3.9 form (i.e. potential binary incompatibility if upstream later decide to do it the conventional way), but should at least fix this crash.

The attached debdiff is for this option, and also fixes #857623 and #857683. Warning: has NOT been tested yet.

I intend to try extending the earlier "version script" patch to also cover libclang and liblldb tomorrow.
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-18 21:33:53.000000000 
+0000
@@ -1,3 +1,11 @@
+llvm-toolchain-3.9 (1:3.9.1-5local1) UNRELEASED; urgency=medium
+
+  * Allow '!pointer' in OpenCL (Closes: #857623)
+  * Add missing liblldb symlink (Closes: #857683)
+  * Use versioned symbols (Closes: #848368)
+
+ -- Rebecca N. Palmer <rebecca_pal...@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-18 
17:33:17.000000000 +0000
@@ -1,3 +1,4 @@
 usr/lib/@DEB_HOST_MULTIARCH@/liblldb-@LLVM_VERSION@.so.1       
usr/lib/@DEB_HOST_MULTIARCH@/liblldb-@LLVM_VERSION@.so
 usr/lib/@DEB_HOST_MULTIARCH@/liblldb-@LLVM_VERSION@.so.1       
usr/lib/llvm-@LLVM_VERSION@/lib/liblldb.so.1
+usr/lib/@DEB_HOST_MULTIARCH@/liblldb-@LLVM_VERSION@.so.1       
usr/lib/llvm-@LLVM_VERSION@/lib/liblldb-@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-18 21:25:52.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/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-18 
21:20:57.000000000 +0000
@@ -47,3 +47,4 @@
 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
diff -Nru llvm-toolchain-3.9-3.9.1/debian/rules 
llvm-toolchain-3.9-3.9.1/debian/rules
--- llvm-toolchain-3.9-3.9.1/debian/rules       2017-01-26 08:35:04.000000000 
+0000
+++ llvm-toolchain-3.9-3.9.1/debian/rules       2017-03-18 17:25:11.000000000 
+0000
@@ -24,7 +24,7 @@
 
 OCAML_STDLIB_DIR    ?= $(shell ocamlc -where)
 
-LDFLAGS_EXTRA =
+LDFLAGS_EXTRA = -Wl,--default-symver
 CXXFLAGS_EXTRA = -std=c++0x
 CONFIGURE_EXTRA =
 CMAKE_EXTRA =

Reply via email to