[commit: ghc] master: When linking with $ORIGIN rpaths, use the "-z origin" linker flag too (9843083)

Ian Lynagh igloo at earth.li
Sat Apr 27 03:09:46 CEST 2013


Repository : http://darcs.haskell.org/ghc.git/

On branch  : master

https://github.com/ghc/ghc/commit/9843083601adb7db03844aecd9a855b0d06609a7

>---------------------------------------------------------------

commit 9843083601adb7db03844aecd9a855b0d06609a7
Author: Ian Lynagh <ian at well-typed.com>
Date:   Sat Apr 27 00:26:06 2013 +0100

    When linking with $ORIGIN rpaths, use the "-z origin" linker flag too
    
    On FreeBSD, one needs use "-z origin" in order to enable resolution
    of $ORIGIN in RPATH. Part of #7819.

>---------------------------------------------------------------

 rts/ghc.mk                | 2 +-
 rules/distdir-way-opts.mk | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/rts/ghc.mk b/rts/ghc.mk
index b3b51a6..b84c9f5 100644
--- a/rts/ghc.mk
+++ b/rts/ghc.mk
@@ -186,7 +186,7 @@ else
 ifneq "$$(UseSystemLibFFI)" "YES"
 LIBFFI_LIBS = -Lrts/dist/build -lffi 
 ifeq "$$(TargetElf)" "YES"
-LIBFFI_LIBS += -optl-Wl,-rpath -optl-Wl,'$$$$ORIGIN'
+LIBFFI_LIBS += -optl-Wl,-rpath -optl-Wl,'$$$$ORIGIN' -optl-Wl,-z -optl-Wl,origin
 endif
 
 else
diff --git a/rules/distdir-way-opts.mk b/rules/distdir-way-opts.mk
index 8d2649f..c78723d 100644
--- a/rules/distdir-way-opts.mk
+++ b/rules/distdir-way-opts.mk
@@ -128,7 +128,7 @@ ifneq "$4" "0"
 ifeq "$$(TargetOS_CPP)" "linux"
 $1_$2_$3_GHC_LD_OPTS += \
     -fno-use-rpaths \
-    $$(foreach d,$$($1_$2_TRANSITIVE_DEPS),-optl-Wl$$(comma)-rpath -optl-Wl$$(comma)'$$$$ORIGIN/../$$d')
+    $$(foreach d,$$($1_$2_TRANSITIVE_DEPS),-optl-Wl$$(comma)-rpath -optl-Wl$$(comma)'$$$$ORIGIN/../$$d') -optl-Wl,-z -optl-Wl,origin
 else ifeq "$$(TargetOS_CPP)" "darwin"
 $1_$2_$3_GHC_LD_OPTS += -optl-Wl,-headerpad_max_install_names
 endif





More information about the ghc-commits mailing list