diff options
Diffstat (limited to 'hadrian')
-rw-r--r-- | hadrian/cfg/system.config.in | 8 | ||||
-rw-r--r-- | hadrian/hadrian.cabal | 1 | ||||
-rw-r--r-- | hadrian/src/Builder.hs | 4 | ||||
-rw-r--r-- | hadrian/src/Oracles/Setting.hs | 6 | ||||
-rw-r--r-- | hadrian/src/Rules/Generate.hs | 2 | ||||
-rw-r--r-- | hadrian/src/Rules/Library.hs | 3 | ||||
-rw-r--r-- | hadrian/src/Settings/Builders/Ld.hs | 1 | ||||
-rw-r--r-- | hadrian/src/Settings/Builders/MergeObjects.hs | 9 | ||||
-rw-r--r-- | hadrian/src/Settings/Default.hs | 2 |
9 files changed, 33 insertions, 3 deletions
diff --git a/hadrian/cfg/system.config.in b/hadrian/cfg/system.config.in index e1b7684b84..7fba53f43e 100644 --- a/hadrian/cfg/system.config.in +++ b/hadrian/cfg/system.config.in @@ -115,6 +115,12 @@ conf-ld-linker-args-stage1 = @CONF_LD_LINKER_OPTS_STAGE1@ conf-ld-linker-args-stage2 = @CONF_LD_LINKER_OPTS_STAGE2@ conf-ld-linker-args-stage3 = @CONF_LD_LINKER_OPTS_STAGE3@ +conf-merge-objects-args-stage0 = @SettingsMergeObjectsFlags@ +conf-merge-objects-args-stage1 = @SettingsMergeObjectsFlags@ +conf-merge-objects-args-stage2 = @SettingsMergeObjectsFlags@ +conf-merge-objects-args-stage3 = @SettingsMergeObjectsFlags@ + + # Settings: #========== @@ -138,6 +144,8 @@ settings-c-compiler-link-flags = @SettingsCCompilerLinkFlags@ settings-c-compiler-supports-no-pie = @SettingsCCompilerSupportsNoPie@ settings-ld-command = @SettingsLdCommand@ settings-ld-flags = @SettingsLdFlags@ +settings-merge-objects-command = @SettingsMergeObjectsCommand@ +settings-merge-objects-flags = @SettingsMergeObjectsFlags@ settings-ar-command = @SettingsArCommand@ settings-ranlib-command = @SettingsRanlibCommand@ settings-dll-wrap-command = @SettingsDllWrapCommand@ diff --git a/hadrian/hadrian.cabal b/hadrian/hadrian.cabal index fed233dea9..d69fddd571 100644 --- a/hadrian/hadrian.cabal +++ b/hadrian/hadrian.cabal @@ -99,6 +99,7 @@ executable hadrian , Settings.Builders.HsCpp , Settings.Builders.Ld , Settings.Builders.Make + , Settings.Builders.MergeObjects , Settings.Builders.RunTest , Settings.Builders.Xelatex , Settings.Default diff --git a/hadrian/src/Builder.hs b/hadrian/src/Builder.hs index e51936ec77..7624ae91ad 100644 --- a/hadrian/src/Builder.hs +++ b/hadrian/src/Builder.hs @@ -127,9 +127,10 @@ data Builder = Alex | Hpc | HsCpp | Hsc2Hs Stage - | Ld Stage + | Ld Stage --- ^ linker | Make FilePath | Makeinfo + | MergeObjects Stage -- ^ linker to be used to merge object files. | Nm | Objdump | Patch @@ -311,6 +312,7 @@ systemBuilderPath builder = case builder of Happy -> fromKey "happy" HsCpp -> fromKey "hs-cpp" Ld _ -> fromKey "ld" + MergeObjects _ -> fromKey "settings-merge-objects-command" Make _ -> fromKey "make" Makeinfo -> fromKey "makeinfo" Nm -> fromKey "nm" diff --git a/hadrian/src/Oracles/Setting.hs b/hadrian/src/Oracles/Setting.hs index bd4d239e68..1e65ddb52d 100644 --- a/hadrian/src/Oracles/Setting.hs +++ b/hadrian/src/Oracles/Setting.hs @@ -91,6 +91,7 @@ data SettingList = ConfCcArgs Stage | ConfCppArgs Stage | ConfGccLinkerArgs Stage | ConfLdLinkerArgs Stage + | ConfMergeObjectsArgs Stage | HsCppArgs -- TODO compute solely in Hadrian, removing these variables' definitions @@ -109,6 +110,8 @@ data SettingsFileSetting | SettingsFileSetting_CCompilerSupportsNoPie | SettingsFileSetting_LdCommand | SettingsFileSetting_LdFlags + | SettingsFileSetting_MergeObjectsCommand + | SettingsFileSetting_MergeObjectsFlags | SettingsFileSetting_ArCommand | SettingsFileSetting_RanlibCommand | SettingsFileSetting_DllWrapCommand @@ -176,6 +179,7 @@ settingList key = fmap words $ lookupValueOrError configFile $ case key of ConfCppArgs stage -> "conf-cpp-args-" ++ stageString stage ConfGccLinkerArgs stage -> "conf-gcc-linker-args-" ++ stageString stage ConfLdLinkerArgs stage -> "conf-ld-linker-args-" ++ stageString stage + ConfMergeObjectsArgs stage -> "conf-merge-objects-args-" ++ stageString stage HsCppArgs -> "hs-cpp-args" -- | Look up the value of a 'SettingList' in @cfg/system.config@, tracking the @@ -191,6 +195,8 @@ settingsFileSetting key = lookupValueOrError configFile $ case key of SettingsFileSetting_CCompilerSupportsNoPie -> "settings-c-compiler-supports-no-pie" SettingsFileSetting_LdCommand -> "settings-ld-command" SettingsFileSetting_LdFlags -> "settings-ld-flags" + SettingsFileSetting_MergeObjectsCommand -> "settings-merge-objects-command" + SettingsFileSetting_MergeObjectsFlags -> "settings-merge-objects-flags" SettingsFileSetting_ArCommand -> "settings-ar-command" SettingsFileSetting_RanlibCommand -> "settings-ranlib-command" SettingsFileSetting_DllWrapCommand -> "settings-dll-wrap-command" diff --git a/hadrian/src/Rules/Generate.hs b/hadrian/src/Rules/Generate.hs index 850bb87de4..5433653da6 100644 --- a/hadrian/src/Rules/Generate.hs +++ b/hadrian/src/Rules/Generate.hs @@ -294,6 +294,8 @@ generateSettings = do , ("ld supports build-id", expr $ lookupValueOrError configFile "ld-has-build-id") , ("ld supports filelist", expr $ lookupValueOrError configFile "ld-has-filelist") , ("ld is GNU ld", expr $ lookupValueOrError configFile "ld-is-gnu-ld") + , ("Merge objects command", expr $ settingsFileSetting SettingsFileSetting_MergeObjectsCommand) + , ("Merge objects flags", expr $ settingsFileSetting SettingsFileSetting_MergeObjectsFlags) , ("ar command", expr $ settingsFileSetting SettingsFileSetting_ArCommand) , ("ar flags", expr $ lookupValueOrError configFile "ar-args") , ("ar supports at file", expr $ yesNo <$> flag ArSupportsAtFile) diff --git a/hadrian/src/Rules/Library.hs b/hadrian/src/Rules/Library.hs index 805213d6ae..4b9d7d6235 100644 --- a/hadrian/src/Rules/Library.hs +++ b/hadrian/src/Rules/Library.hs @@ -92,6 +92,7 @@ buildDynamicLibUnix root suffix dynlibpath = do -- | Build a "GHCi library" ('LibGhci') under the given build root, with the -- complete path of the file to build is given as the second argument. +-- See Note [Merging object files for GHCi] in GHC.Driver.Pipeline. buildGhciLibO :: FilePath -> FilePath -> Action () buildGhciLibO root ghcilibPath = do l@(BuildPath _ stage _ (LibGhci _ _ _)) @@ -101,7 +102,7 @@ buildGhciLibO root ghcilibPath = do let context = libGhciContext l objs <- allObjects context need objs - build $ target context (Ld stage) objs [ghcilibPath] + build $ target context (MergeObjects stage) objs [ghcilibPath] -- * Helpers diff --git a/hadrian/src/Settings/Builders/Ld.hs b/hadrian/src/Settings/Builders/Ld.hs index 2715bbb20c..c0c6a7083b 100644 --- a/hadrian/src/Settings/Builders/Ld.hs +++ b/hadrian/src/Settings/Builders/Ld.hs @@ -4,6 +4,5 @@ import Settings.Builders.Common ldBuilderArgs :: Args ldBuilderArgs = builder Ld ? mconcat [ getStagedSettingList ConfLdLinkerArgs - , arg "-r" , arg "-o", arg =<< getOutput , getInputs ] diff --git a/hadrian/src/Settings/Builders/MergeObjects.hs b/hadrian/src/Settings/Builders/MergeObjects.hs new file mode 100644 index 0000000000..f5467b43ea --- /dev/null +++ b/hadrian/src/Settings/Builders/MergeObjects.hs @@ -0,0 +1,9 @@ +module Settings.Builders.MergeObjects (mergeObjectsBuilderArgs) where + +import Settings.Builders.Common + +mergeObjectsBuilderArgs :: Args +mergeObjectsBuilderArgs = builder MergeObjects ? mconcat + [ getStagedSettingList ConfMergeObjectsArgs + , arg "-o", arg =<< getOutput + , getInputs ] diff --git a/hadrian/src/Settings/Default.hs b/hadrian/src/Settings/Default.hs index f74546a437..d965133a88 100644 --- a/hadrian/src/Settings/Default.hs +++ b/hadrian/src/Settings/Default.hs @@ -37,6 +37,7 @@ import Settings.Builders.Hsc2Hs import Settings.Builders.HsCpp import Settings.Builders.Ld import Settings.Builders.Make +import Settings.Builders.MergeObjects import Settings.Builders.RunTest import Settings.Builders.Xelatex import Settings.Packages @@ -244,6 +245,7 @@ defaultBuilderArgs = mconcat , hsCppBuilderArgs , ldBuilderArgs , makeBuilderArgs + , mergeObjectsBuilderArgs , runTestBuilderArgs , validateBuilderArgs , xelatexBuilderArgs |