summaryrefslogtreecommitdiff
path: root/aclocal.m4
diff options
context:
space:
mode:
authorHerbert Valerio Riedel <hvr@gnu.org>2015-11-19 12:56:48 +0100
committerBen Gamari <ben@smart-cactus.org>2015-11-19 13:24:33 +0100
commit75036aacb492886a7c65035127ee11fec11ee7ce (patch)
treec6976a4b7fe4bb48b542b0515860cfd516366da8 /aclocal.m4
parentc5d8162d230c373b2b49ec94d3f9a027ff6e2dd6 (diff)
downloadhaskell-75036aacb492886a7c65035127ee11fec11ee7ce.tar.gz
Set AIX specific CFLAGS flags
First of all, we need to use -mminimal-toc on IBM AIX AIX's XCOFF is limited to 16k entries in its TOC for 32bit compilation, which quickly overflows with GHC's code generation. Otoh, the Parser.hs module contains more entries than fit into a minimal-toc, so we need to switch back to `-mfull-toc` for that single module again. Then, we also need to set the `THREAD_SAFE` CPP #define in order to unlock the thread-safe `errno` which is essential for the threaded runtime. Depends on D1501 Reviewers: austin, bgamari Reviewed By: bgamari Subscribers: thomie, erikd Differential Revision: https://phabricator.haskell.org/D1502
Diffstat (limited to 'aclocal.m4')
-rw-r--r--aclocal.m414
1 files changed, 14 insertions, 0 deletions
diff --git a/aclocal.m4 b/aclocal.m4
index e816e09b54..4bd8198beb 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -587,6 +587,20 @@ AC_DEFUN([FPTOOLS_SET_C_LD_FLAGS],
$3="$$3 -fuse-ld=gold -Wl,-z,noexecstack"
$4="$$4 -z noexecstack"
;;
+
+ powerpc-ibm-aix*)
+ # On IBM AIX, we need to workaround XCOFF's limitations. Specifically,
+ # there's a TOC which only supports at most 16k entries (see
+ # http://www.ibm.com/developerworks/rational/library/overview-toc-aix/
+ # for more details), and by using `-mminimal-toc` we use up only one TOC
+ # entry per translation unit, at the cost of an additional pointer
+ # indirection. However, see note in `compiler/ghc.mk` about `Parser.hs`.
+ # Finally, we need `-D_THREAD_SAFE` to unlock a thread-local `errno`.
+ $2="$$2 -mminimal-toc -D_THREAD_SAFE"
+ $3="$$3 -mminimal-toc -D_THREAD_SAFE"
+ $5="$$5 -D_THREAD_SAFE"
+ ;;
+
esac
# If gcc knows about the stack protector, turn it off.