diff options
-rw-r--r-- | compiler/GHC/Driver/Session.hs | 20 | ||||
-rw-r--r-- | docs/users_guide/phases.rst | 4 |
2 files changed, 15 insertions, 9 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) && diff --git a/docs/users_guide/phases.rst b/docs/users_guide/phases.rst index aa171c2055..8d0c32f5c1 100644 --- a/docs/users_guide/phases.rst +++ b/docs/users_guide/phases.rst @@ -909,10 +909,12 @@ for example). option for Apple's Linker (``-F`` already means something else for GHC). -.. ghc-flag:: -split-sections +.. ghc-flag:: -fsplit-sections + -split-sections :shortdesc: Split sections for link-time dead-code stripping :type: dynamic :category: linking + :reverse: -fno-split-sections Place each generated function or data item into its own section in the output file if the target supports arbitrary sections. The name of the |