commit:     cb457be480d98311749a11aae514aaaf3c553a2f
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Fri Mar  9 07:50:39 2018 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Fri Mar  9 14:58:23 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=cb457be4

sys-devel/llvm: Backport -Wl,-rpath-link non-Linux fix to 6.0.9999

 ...pend-Wl-rpath-link-conditionally-to-GNULD.patch | 38 ++++++++++++++++++++++
 sys-devel/llvm/llvm-6.0.9999.ebuild                |  3 ++
 2 files changed, 41 insertions(+)

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
index 00000000000..5d1f042164e
--- /dev/null
+++ 
b/sys-devel/llvm/files/6.0.9999/0001-cmake-Append-Wl-rpath-link-conditionally-to-GNULD.patch
@@ -0,0 +1,38 @@
+From a7c94b20187a60cf1508ce882ee37b3a056eb0bd Mon Sep 17 00:00:00 2001
+From: Michal Gorny <mgo...@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
+

diff --git a/sys-devel/llvm/llvm-6.0.9999.ebuild 
b/sys-devel/llvm/llvm-6.0.9999.ebuild
index d460300fe42..2f7469162d7 100644
--- a/sys-devel/llvm/llvm-6.0.9999.ebuild
+++ b/sys-devel/llvm/llvm-6.0.9999.ebuild
@@ -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
 

Reply via email to