summaryrefslogtreecommitdiff
path: root/mk
diff options
context:
space:
mode:
authorSimon Brenner <olsner@gmail.com>2016-12-16 12:16:05 -0500
committerBen Gamari <ben@smart-cactus.org>2016-12-16 12:17:01 -0500
commit8f71d9581ee0a1826c0105e51a7048f0c7669492 (patch)
tree0a11a9c7e229bafde68ed11bcb076d7d54411d96 /mk
parent4026b452817e9d4241691c58d131904bd0eb1fec (diff)
downloadhaskell-8f71d9581ee0a1826c0105e51a7048f0c7669492.tar.gz
Enable split sections by default where possible
On non-windows platforms with GNU ld, enable SplitSections in the GHC build by default. Reviewers: austin, bgamari Reviewed By: bgamari Subscribers: DemiMarie, thomie Differential Revision: https://phabricator.haskell.org/D1800 GHC Trac Issues: #11445
Diffstat (limited to 'mk')
-rw-r--r--mk/config.mk.in21
1 files changed, 16 insertions, 5 deletions
diff --git a/mk/config.mk.in b/mk/config.mk.in
index 06c12bfb44..5141ccf724 100644
--- a/mk/config.mk.in
+++ b/mk/config.mk.in
@@ -339,8 +339,12 @@ SupportsSplitObjs := $(strip \
$(filter NO,$(GhcUnregisterised))),\
YES,NO))
-# By default, enable SplitObjs for the libraries if this build supports it
-SplitObjs=$(SupportsSplitObjs)
+# By default, enable SplitObjs for the libraries if this build supports it.
+# Unless SplitSections is enabled - then let that take precedence.
+SplitObjs = $(strip \
+ $(if $(and $(filter YES,$(SupportsSplitObjs)),\
+ $(filter NO,$(SplitSections))),\
+ YES,NO))
# ----------------------------------------------------------------------------
# Section splitting
@@ -349,9 +353,16 @@ SplitObjs=$(SupportsSplitObjs)
# like SplitObjs, but doesn't require post-processing and splitting of object
# files.
#
-# Set SplitSections=YES in your build.mk to enable.
-
-SplitSections=NO
+# Set SplitSections=YES or NO in your build.mk to override the default.
+#
+# This is not supported on Darwin (where you can use subsections-via-symbols
+# instead) and Windows is not yet working. (See #11445 and related tickets.)
+OsSupportsSplitSections=$(strip $(if $(filter $(TargetOS_CPP),mingw32 darwin),NO,YES))
+SupportsSplitSections = $(strip \
+ $(if $(and $(filter YES,$(OsSupportsSplitSections)),\
+ $(filter YES,$(LdIsGNULd))),\
+ YES,NO))
+SplitSections ?= $(SupportsSplitSections)
# ----------------------------------------------------------------------------