summaryrefslogtreecommitdiff
path: root/rules
diff options
context:
space:
mode:
authorChristiaan Baaj <christiaan.baaij@gmail.com>2014-01-28 08:24:55 -0600
committerAustin Seipp <austin@well-typed.com>2014-01-28 08:24:55 -0600
commitf7be53ac9dac85b83e7fe5ecede01b98a572ba48 (patch)
treeddf358efae5f9ba93ef9dd7e252311399417b00c /rules
parent943f22a4c959a2d0c0e47fc40c2163ef7760b6d9 (diff)
downloadhaskell-f7be53ac9dac85b83e7fe5ecede01b98a572ba48.tar.gz
Fix inplace dynamic linking on OS X (#8266)
Signed-off-by: Austin Seipp <austin@well-typed.com>
Diffstat (limited to 'rules')
-rw-r--r--rules/build-package-way.mk1
-rw-r--r--rules/build-prog.mk4
-rw-r--r--rules/distdir-way-opts.mk4
-rw-r--r--rules/relative-dynlib-references.mk55
4 files changed, 3 insertions, 61 deletions
diff --git a/rules/build-package-way.mk b/rules/build-package-way.mk
index 305252be47..294e43274a 100644
--- a/rules/build-package-way.mk
+++ b/rules/build-package-way.mk
@@ -91,7 +91,6 @@ $$($1_$2_$3_LIB) : $$($1_$2_$3_ALL_OBJS) $$(ALL_RTS_LIBS) $$($1_$2_$3_DEPS_LIBS)
$$(addprefix -l,$$($1_$2_EXTRA_LIBRARIES)) $$(addprefix -L,$$($1_$2_EXTRA_LIBDIRS)) \
-no-auto-link-packages \
-o $$@
- $(call relative-dynlib-references,$1,$2,$4)
endif
else
# Build the ordinary .a library
diff --git a/rules/build-prog.mk b/rules/build-prog.mk
index 5837bb0c84..c6780d1bde 100644
--- a/rules/build-prog.mk
+++ b/rules/build-prog.mk
@@ -261,10 +261,6 @@ ifeq "$$($1_$2_LINK_WITH_GCC)" "NO"
$1/$2/build/tmp/$$($1_$2_PROG) : $$($1_$2_$$($1_$2_PROGRAM_WAY)_HS_OBJS) $$($1_$2_$$($1_$2_PROGRAM_WAY)_C_OBJS) $$($1_$2_$$($1_$2_PROGRAM_WAY)_S_OBJS) $$($1_$2_OTHER_OBJS) | $$$$(dir $$$$@)/.
$$(call cmd,$1_$2_HC) -o $$@ $$($1_$2_$$($1_$2_PROGRAM_WAY)_ALL_HC_OPTS) $$(LD_OPTS) $$($1_$2_$$($1_$2_PROGRAM_WAY)_GHC_LD_OPTS) $$($1_$2_$$($1_$2_PROGRAM_WAY)_HS_OBJS) $$($1_$2_$$($1_$2_PROGRAM_WAY)_C_OBJS) $$($1_$2_$$($1_$2_PROGRAM_WAY)_S_OBJS) $$($1_$2_OTHER_OBJS) $$(addprefix -l,$$($1_$2_EXTRA_LIBRARIES))
-ifeq "$$($1_$2_PROGRAM_WAY)" "dyn"
- $(call relative-dynlib-references,$1,$2,$3)
- $(call relative-dynlib-path,$3)
-endif
else
$1/$2/build/tmp/$$($1_$2_PROG) : $$($1_$2_$$($1_$2_PROGRAM_WAY)_HS_OBJS) $$($1_$2_$$($1_$2_PROGRAM_WAY)_C_OBJS) $$($1_$2_$$($1_$2_PROGRAM_WAY)_S_OBJS) $$($1_$2_OTHER_OBJS) | $$$$(dir $$$$@)/.
$$(call cmd,$1_$2_CC) -o $$@ $$($1_$2_$$($1_$2_PROGRAM_WAY)_ALL_CC_OPTS) $$(LD_OPTS) $$($1_$2_$$($1_$2_PROGRAM_WAY)_HS_OBJS) $$($1_$2_$$($1_$2_PROGRAM_WAY)_C_OBJS) $$($1_$2_$$($1_$2_PROGRAM_WAY)_S_OBJS) $$($1_$2_OTHER_OBJS) $$($1_$2_$$($1_$2_PROGRAM_WAY)_EXTRA_CC_OPTS) $$(addprefix -l,$$($1_$2_EXTRA_LIBRARIES))
diff --git a/rules/distdir-way-opts.mk b/rules/distdir-way-opts.mk
index a4f525e896..8c0377eff8 100644
--- a/rules/distdir-way-opts.mk
+++ b/rules/distdir-way-opts.mk
@@ -138,7 +138,9 @@ $1_$2_$3_GHC_LD_OPTS += \
-fno-use-rpaths \
$$(foreach d,$$($1_$2_TRANSITIVE_DEPS),-optl-Wl$$(comma)-rpath -optl-Wl$$(comma)'$$$$ORIGIN/../$$d') -optl-Wl,-zorigin
else ifeq "$$(TargetOS_CPP)" "darwin"
-$1_$2_$3_GHC_LD_OPTS += -optl-Wl,-headerpad_max_install_names
+$1_$2_$3_GHC_LD_OPTS += \
+ -fno-use-rpaths \
+ $$(foreach d,$$($1_$2_TRANSITIVE_DEPS),-optl-Wl$$(comma)-rpath -optl-Wl$$(comma)'@loader_path/../$$d')
endif
endif
endif
diff --git a/rules/relative-dynlib-references.mk b/rules/relative-dynlib-references.mk
deleted file mode 100644
index e117ddefb4..0000000000
--- a/rules/relative-dynlib-references.mk
+++ /dev/null
@@ -1,55 +0,0 @@
-# -----------------------------------------------------------------------------
-#
-# (c) 2009 The University of Glasgow
-#
-# This file is part of the GHC build system.
-#
-# To understand how the build system works and how to modify it, see
-# http://ghc.haskell.org/trac/ghc/wiki/Building/Architecture
-# http://ghc.haskell.org/trac/ghc/wiki/Building/Modifying
-#
-# -----------------------------------------------------------------------------
-
-
-# Make dynlib references use relative paths, so that everything works
-# without the build tree.
-
-define relative-dynlib-references
-# $1 = dir
-# $2 = distdir
-# $3 = GHC stage to use (0 == bootstrapping compiler)
-# $4 = RTSway
-
-ifeq "$$(TargetOS_CPP)" "darwin"
-ifneq "$3" "0"
-# Use relative paths for all the libraries
-ifneq "$$($1_$2_TRANSITIVE_DEP_NAMES)" ""
- install_name_tool $$(foreach d,$$($1_$2_TRANSITIVE_DEP_NAMES), -change $$(TOP)/$$($$($$d_INSTALL_INFO)_dyn_LIB) @rpath/$$d-$$($$($$d_INSTALL_INFO)_VERSION)/$$($$($$d_INSTALL_INFO)_dyn_LIB_NAME)) $$@
-endif
-# Change absolute library name/path to a relative name/path
-ifeq "$$($1_$2_PROGNAME)" ""
-ifeq "$1" "rts"
- install_name_tool -id @rpath/rts-$$(rts_VERSION)/$$(rts_$4_LIB_NAME) $$@
-else
- install_name_tool -id @rpath/$$($1_PACKAGE)-$$($1_$2_VERSION)/$$($1_$2_dyn_LIB_NAME) $$@
-endif
-endif
-# Use relative paths for the RTS. Rather than try to work out which RTS
-# way is being linked, we just change it for all ways
- install_name_tool $$(foreach w,$$(rts_WAYS), -change $$(TOP)/$$(rts_$$w_LIB) @rpath/rts-$$(rts_VERSION)/$$(rts_$$w_LIB_NAME)) $$@
- install_name_tool -change $$(TOP)/$$(wildcard libffi/build/inst/lib/libffi.*.dylib) @rpath/rts-$$(rts_VERSION)/libffi.dylib $$@
-endif
-endif
-
-endef
-
-define relative-dynlib-path
-# $1 = GHC stage to use (0 == bootstrapping compiler)
-
-ifeq "$$(TargetOS_CPP)" "darwin"
-ifneq "$1" "0"
- install_name_tool -rpath $$(TOP)/inplace/lib @loader_path/.. $$@
-endif
-endif
-
-endef