[commit: ghc] ghc-8.0: pass -z wxneeded or -Wl, -zwxneeded for linking on OpenBSD (5370f3c)
git at git.haskell.org
git at git.haskell.org
Tue Aug 30 21:43:53 UTC 2016
Repository : ssh://git@git.haskell.org/ghc
On branch : ghc-8.0
Link : http://ghc.haskell.org/trac/ghc/changeset/5370f3cb40aaf758f39b4b0db8b38dce68fd57aa/ghc
>---------------------------------------------------------------
commit 5370f3cb40aaf758f39b4b0db8b38dce68fd57aa
Author: Karel Gardas <karel.gardas at centrum.cz>
Date: Sat Aug 13 18:49:53 2016 +0200
pass -z wxneeded or -Wl,-zwxneeded for linking on OpenBSD
Summary:
This patch fixes issue with abort in GHCi on OpenBSD current
as of Aug 12 2016. The OpenBSD is more and more strict about usage
of writable and executable memory. Programs/applications which
requires such functionality need to be linked with -z wxneeded linker
flag and need to be run from the file-system mounted with wxallowed
mount option. If either of those options in not met, then problematic
program/application usually fail on some mmap/mprotect call which fail.
Reviewers: bgamari, austin, hvr
Subscribers: thomie, erikd
Differential Revision: https://phabricator.haskell.org/D2454
(cherry picked from commit f9aa996f0af59f32dc7b1528ff78be41413a9c27)
>---------------------------------------------------------------
5370f3cb40aaf758f39b4b0db8b38dce68fd57aa
aclocal.m4 | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/aclocal.m4 b/aclocal.m4
index 18b9529..0c842d5 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -601,6 +601,13 @@ AC_DEFUN([FPTOOLS_SET_C_LD_FLAGS],
$5="$$5 -D_THREAD_SAFE"
;;
+ 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"
+ $4="$$4 -z wxneeded"
+ ;;
+
esac
# If gcc knows about the stack protector, turn it off.
More information about the ghc-commits
mailing list