When linking with $ORIGIN rpaths, use the "-z origin" linker flag too
authorIan Lynagh <ian@well-typed.com>
Fri, 26 Apr 2013 23:26:06 +0000 (00:26 +0100)
committerIan Lynagh <ian@well-typed.com>
Fri, 26 Apr 2013 23:26:06 +0000 (00:26 +0100)
On FreeBSD, one needs use "-z origin" in order to enable resolution
of $ORIGIN in RPATH. Part of #7819.

rts/ghc.mk
rules/distdir-way-opts.mk

index b3b51a6..b84c9f5 100644 (file)
@@ -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
index 8d2649f..c78723d 100644 (file)
@@ -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