diff options
Diffstat (limited to 'compiler/main')
-rw-r--r-- | compiler/main/DriverPipeline.hs | 4 | ||||
-rw-r--r-- | compiler/main/DynFlags.hs | 8 | ||||
-rw-r--r-- | compiler/main/HscMain.hs | 2 | ||||
-rw-r--r-- | compiler/main/SysTools.hs | 1 |
4 files changed, 13 insertions, 2 deletions
diff --git a/compiler/main/DriverPipeline.hs b/compiler/main/DriverPipeline.hs index f8b7c30300..8373f20c73 100644 --- a/compiler/main/DriverPipeline.hs +++ b/compiler/main/DriverPipeline.hs @@ -1904,6 +1904,10 @@ linkBinary' staticLink dflags o_files dep_packages = do then ["-Wl,-read_only_relocs,suppress"] else []) + ++ (if sLdIsGnuLd mySettings + then ["-Wl,--gc-sections"] + else []) + ++ o_files ++ lib_path_opts) ++ extra_ld_inputs diff --git a/compiler/main/DynFlags.hs b/compiler/main/DynFlags.hs index 6b44e16c7a..0f07ddff33 100644 --- a/compiler/main/DynFlags.hs +++ b/compiler/main/DynFlags.hs @@ -398,6 +398,7 @@ data GeneralFlag | Opt_EagerBlackHoling | Opt_NoHsMain | Opt_SplitObjs + | Opt_SplitSections | Opt_StgStats | Opt_HideAllPackages | Opt_PrintBindResult @@ -1312,7 +1313,10 @@ wayUnsetGeneralFlags _ WayDyn = [-- There's no point splitting objects -- when we're going to be dynamically -- linking. Plus it breaks compilation -- on OSX x86. - Opt_SplitObjs] + Opt_SplitObjs, + -- If splitobjs wasn't useful for this, + -- assume sections aren't either. + Opt_SplitSections] wayUnsetGeneralFlags _ WayProf = [] wayUnsetGeneralFlags _ WayEventLog = [] @@ -2354,6 +2358,8 @@ dynamic_flags = [ then setGeneralFlag Opt_SplitObjs else addWarn "ignoring -fsplit-objs")) + , defGhcFlag "split-sections" (NoArg (setGeneralFlag Opt_SplitSections)) + -------- ghc -M ----------------------------------------------------- , defGhcFlag "dep-suffix" (hasArg addDepSuffix) , defGhcFlag "dep-makefile" (hasArg setDepMakefile) diff --git a/compiler/main/HscMain.hs b/compiler/main/HscMain.hs index c7cabe6f9a..08e5235cc6 100644 --- a/compiler/main/HscMain.hs +++ b/compiler/main/HscMain.hs @@ -1333,7 +1333,7 @@ doCodeGen hsc_env this_mod data_tycons -- we generate one SRT for the whole module. let pipeline_stream - | gopt Opt_SplitObjs dflags + | gopt Opt_SplitObjs dflags || gopt Opt_SplitSections dflags = {-# SCC "cmmPipeline" #-} let run_pipeline us cmmgroup = do let (topSRT', us') = initUs us emptySRT diff --git a/compiler/main/SysTools.hs b/compiler/main/SysTools.hs index b624862191..9f9348aecc 100644 --- a/compiler/main/SysTools.hs +++ b/compiler/main/SysTools.hs @@ -796,6 +796,7 @@ getLinkerInfo' dflags = do -- GNU ld specifically needs to use less memory. This especially -- hurts on small object files. Trac #5240. -- Set DT_NEEDED for all shared libraries. Trac #10110. + -- TODO: Investigate if these help or hurt when using split sections. return (GnuLD $ map Option ["-Wl,--hash-size=31", "-Wl,--reduce-memory-overheads", -- ELF specific flag |