[commit: ghc] master: fix OpenBSD linkage (wxneeded) (87c3b1d)
git at git.haskell.org
git at git.haskell.org
Sat Dec 17 22:51:13 UTC 2016
Repository : ssh://git@git.haskell.org/ghc
On branch : master
Link : http://ghc.haskell.org/trac/ghc/changeset/87c3b1d4395c3d4fc7a5272717c48f3f525da959/ghc
>---------------------------------------------------------------
commit 87c3b1d4395c3d4fc7a5272717c48f3f525da959
Author: Sergei Trofimovich <siarheit at google.com>
Date: Sat Dec 17 20:25:19 2016 +0000
fix OpenBSD linkage (wxneeded)
There is two types of options passed directly to 'ld'
(and not to 'gcc' driver):
- CONF_LD_LINKER_OPTS_STAGE$4
- EXTRA_LD_OPTS
This changedoes two things:
- split 'EXTRA_LD_OPTS' into two variables:
- EXTRA_LD_OPTS (accepts 'gcc' wrapper options)
- EXTRA_LD_LINKER_OPTS (accepts raw 'ld' options)
- wraps all LD_LINKER options as '-Wl,' when passed
to 'gcc' driver.
Fixes https://phabricator.haskell.org/D2776
Signed-off-by: Sergei Trofimovich <siarheit at google.com>
>---------------------------------------------------------------
87c3b1d4395c3d4fc7a5272717c48f3f525da959
aclocal.m4 | 2 +-
rules/build-package-way.mk | 2 +-
rules/distdir-way-opts.mk | 5 +++--
3 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/aclocal.m4 b/aclocal.m4
index 5d39570..4673ac0 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -658,7 +658,7 @@ AC_DEFUN([FPTOOLS_SET_C_LD_FLAGS],
x86_64-*-openbsd*)
# We need -z wxneeded at least to link ghc-stage2 to workaround
# W^X issue in GHCi on OpenBSD current (as of Aug 2016)
- $3="$$3 -Wl,-zwxneeded"
+ $3="$$3 -Wl,-z,wxneeded"
$4="$$4 -z wxneeded"
;;
diff --git a/rules/build-package-way.mk b/rules/build-package-way.mk
index 905b7f0..8f61a35 100644
--- a/rules/build-package-way.mk
+++ b/rules/build-package-way.mk
@@ -155,7 +155,7 @@ BINDIST_LIBS += $$($1_$2_GHCI_LIB)
endif
endif
$$($1_$2_GHCI_LIB) : $$($1_$2_$3_HS_OBJS) $$($1_$2_$3_CMM_OBJS) $$($1_$2_$3_C_OBJS) $$($1_$2_$3_S_OBJS) $$($1_$2_EXTRA_OBJS) $$($1_$2_LD_SCRIPT)
- $$(call cmd,LD) $$(CONF_LD_LINKER_OPTS_STAGE$4) -r $$(if $$($1_$2_LD_SCRIPT),-T $$($1_$2_LD_SCRIPT)) -o $$@ $$(EXTRA_LD_OPTS) $$($1_$2_$3_HS_OBJS) $$($1_$2_$3_CMM_OBJS) $$($1_$2_$3_C_OBJS) $$($1_$2_$3_S_OBJS) $$($1_$2_EXTRA_OBJS)
+ $$(call cmd,LD) $$(CONF_LD_LINKER_OPTS_STAGE$4) -r $$(if $$($1_$2_LD_SCRIPT),-T $$($1_$2_LD_SCRIPT)) -o $$@ $$(EXTRA_LD_LINKER_OPTS) $$($1_$2_$3_HS_OBJS) $$($1_$2_$3_CMM_OBJS) $$($1_$2_$3_C_OBJS) $$($1_$2_$3_S_OBJS) $$($1_$2_EXTRA_OBJS)
ifeq "$$($1_$2_BUILD_GHCI_LIB)" "YES"
# Don't bother making ghci libs for bootstrapping packages
diff --git a/rules/distdir-way-opts.mk b/rules/distdir-way-opts.mk
index 6ae9807..62a1451 100644
--- a/rules/distdir-way-opts.mk
+++ b/rules/distdir-way-opts.mk
@@ -196,14 +196,15 @@ $1_$2_$3_GHC_CC_OPTS = \
$$(addprefix -optc, $$($1_$2_$3_ALL_CC_OPTS)) \
$$($1_$2_$3_MOST_HC_OPTS)
-# Options for passing to plain ld
+# Options for passing to gcc for linking
$1_$2_$3_ALL_LD_OPTS = \
$$(WAY_$3_LD_OPTS) \
$$($1_$2_DIST_LD_OPTS) \
$$($1_$2_$3_LD_OPTS) \
$$($1_$2_EXTRA_LD_OPTS) \
$$(EXTRA_LD_OPTS) \
- $$(CONF_LD_LINKER_OPTS_STAGE$4)
+ $$(foreach o,$$(EXTRA_LD_LINKER_OPTS),-optl-Wl$$(comma)$$o) \
+ $$(foreach o,$$(CONF_LD_LINKER_OPTS_STAGE$4),-optl-Wl$$(comma)$$o)
# Options for passing to GHC when we use it for linking
$1_$2_$3_GHC_LD_OPTS = \
More information about the ghc-commits
mailing list