summaryrefslogtreecommitdiff
path: root/compiler/GHC
diff options
context:
space:
mode:
authorMatthew Pickering <matthewtpickering@gmail.com>2022-12-07 10:33:11 +0000
committerMatthew Pickering <matthewtpickering@gmail.com>2023-01-04 11:58:42 +0000
commit32255d055b768d51deb9d1f49681164cf7492011 (patch)
treefb9b6ab9c77366b59b19f1f07ac275300d21e348 /compiler/GHC
parent21bedd84f2cde6aa17d09c610a2a309f3e2a7f10 (diff)
downloadhaskell-32255d055b768d51deb9d1f49681164cf7492011.tar.gz
compiler: Add -f[no-]split-sections flags
Here we add a `-fsplit-sections` flag which may some day replace `-split-sections`. This has the advantage of automatically providing a `-fno-split-sections` flag, which is useful for our packaging because we enable `-split-sections` by default but want to disable it in certain configurations.
Diffstat (limited to 'compiler/GHC')
-rw-r--r--compiler/GHC/Driver/Session.hs20
1 files changed, 12 insertions, 8 deletions
diff --git a/compiler/GHC/Driver/Session.hs b/compiler/GHC/Driver/Session.hs
index 831267e2bf..07106c7c8c 100644
--- a/compiler/GHC/Driver/Session.hs
+++ b/compiler/GHC/Driver/Session.hs
@@ -2192,14 +2192,10 @@ dynamic_flags_deps = [
, make_ord_flag defGhcFlag "split-objs"
(NoArg $ addWarn "ignoring -split-objs")
+ -- N.B. We may someday deprecate this in favor of -fsplit-sections,
+ -- which has the benefit of also having a negating -fno-split-sections.
, make_ord_flag defGhcFlag "split-sections"
- (noArgM (\dflags -> do
- if platformHasSubsectionsViaSymbols (targetPlatform dflags)
- then do addWarn $
- "-split-sections is not useful on this platform " ++
- "since it always uses subsections via symbols. Ignoring."
- return dflags
- else return (gopt_set dflags Opt_SplitSections)))
+ (NoArg $ setGeneralFlag Opt_SplitSections)
-------- ghc -M -----------------------------------------------------
, make_ord_flag defGhcFlag "dep-suffix" (hasArg addDepSuffix)
@@ -3514,7 +3510,8 @@ fFlagsDeps = [
(addWarn "-compact-unwind is only implemented by the darwin platform. Ignoring.")
return dflags)),
flagSpec "show-error-context" Opt_ShowErrorContext,
- flagSpec "cmm-thread-sanitizer" Opt_CmmThreadSanitizer
+ flagSpec "cmm-thread-sanitizer" Opt_CmmThreadSanitizer,
+ flagSpec "split-sections" Opt_SplitSections
]
++ fHoleFlags
@@ -4800,6 +4797,13 @@ makeDynFlagsConsistent dflags
warn = "-dynamic-too is ignored when using -dynamic"
in loop dflags' warn
+ | gopt Opt_SplitSections dflags
+ , platformHasSubsectionsViaSymbols (targetPlatform dflags)
+ = let dflags' = gopt_unuset dflags Opt_SplitSections
+ warn = "-fsplit-sections is not useful on this platform " ++
+ "since it uses subsections-via-symbols. Ignoring."
+ in loop dflags' warn
+
-- Via-C backend only supports unregisterised ABI. Switch to a backend
-- supporting it if possible.
| backendUnregisterisedAbiOnly (backend dflags) &&