sys-devel/llvm: Backport -Wl,-rpath-link non-Linux fix to 6.0.9999
authorMichał Górny <mgorny@gentoo.org>
Fri, 9 Mar 2018 07:50:39 +0000 (08:50 +0100)
committerMichał Górny <mgorny@gentoo.org>
Fri, 9 Mar 2018 14:58:23 +0000 (15:58 +0100)
sys-devel/llvm/files/6.0.9999/0001-cmake-Append-Wl-rpath-link-conditionally-to-GNULD.patch [new file with mode: 0644]
sys-devel/llvm/llvm-6.0.9999.ebuild

diff --git a/sys-devel/llvm/files/6.0.9999/0001-cmake-Append-Wl-rpath-link-conditionally-to-GNULD.patch b/sys-devel/llvm/files/6.0.9999/0001-cmake-Append-Wl-rpath-link-conditionally-to-GNULD.patch
new file mode 100644 (file)
index 0000000..5d1f042
--- /dev/null
@@ -0,0 +1,38 @@
+From a7c94b20187a60cf1508ce882ee37b3a056eb0bd Mon Sep 17 00:00:00 2001
+From: Michal Gorny <mgorny@gentoo.org>
+Date: Thu, 8 Mar 2018 15:09:38 +0000
+Subject: [PATCH] [cmake] Append -Wl,-rpath-link conditionally to GNULD
+
+Append -Wl,-rpath-link conditionally to whether GNU ld.bfd is used
+rather than the Linux+!gold conditionals. Also move it out of 'else'
+branch of *BSD handling. This fixes build failures with ld.bfd
+on Gentoo/FreeBSD, and should cause no harm on other systems using
+ld.bfd.
+
+This patch improves the original logic by reusing results of linker
+detection introduced in r307852.
+
+Differential Revision: https://reviews.llvm.org/D43751
+
+git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@327007 91177308-0d34-0410-b5e6-96231b3b80d8
+---
+ cmake/modules/AddLLVM.cmake | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/cmake/modules/AddLLVM.cmake b/cmake/modules/AddLLVM.cmake
+index 20166d2cd30..95d47d00e51 100644
+--- a/cmake/modules/AddLLVM.cmake
++++ b/cmake/modules/AddLLVM.cmake
+@@ -1589,7 +1589,8 @@ function(llvm_setup_rpath name)
+     if(${CMAKE_SYSTEM_NAME} MATCHES "(FreeBSD|DragonFly)")
+       set_property(TARGET ${name} APPEND_STRING PROPERTY
+                    LINK_FLAGS " -Wl,-z,origin ")
+-    elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Linux" AND NOT LLVM_LINKER_IS_GOLD)
++    endif()
++    if(LLVM_LINKER_IS_GNULD)
+       # $ORIGIN is not interpreted at link time by ld.bfd
+       set_property(TARGET ${name} APPEND_STRING PROPERTY
+                    LINK_FLAGS " -Wl,-rpath-link,${LLVM_LIBRARY_OUTPUT_INTDIR} ")
+-- 
+2.16.2
+
index d460300fe422613d5423139d95bbf93c5d5f9ba9..2f7469162d78a23cf7572a8722ecacad32885685 100644 (file)
@@ -80,6 +80,9 @@ src_prepare() {
        # https://bugs.gentoo.org/show_bug.cgi?id=565358
        eapply "${FILESDIR}"/9999/0007-llvm-config-Clean-up-exported-values-update-for-shar.patch
 
+       # Fix appending -Wl,-rpath-link on non-Linux (-> FreeBSD).
+       eapply "${FILESDIR}"/6.0.9999/0001-cmake-Append-Wl-rpath-link-conditionally-to-GNULD.patch
+
        # disable use of SDK on OSX, bug #568758
        sed -i -e 's/xcrun/false/' utils/lit/lit/util.py || die