diff options
author | Ben Gamari <ben@smart-cactus.org> | 2020-08-01 11:34:32 -0400 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2020-08-03 09:15:53 -0400 |
commit | cf656aba070c8d2da91cadf3cbfbb9d91005e717 (patch) | |
tree | b4e939c423e34f12bc2110653d36ec675c2406cb /compiler/GHC/SysTools/Tasks.hs | |
parent | f9b7497d30d98a054d4ec5a8df2dfaf4a2b0bb30 (diff) | |
download | haskell-wip/T17962b.tar.gz |
Refactor handling of object mergingwip/T17962b
Previously to merge a set of object files we would invoke the linker as
usual, adding -r to the command-line. However, this can result in
non-sensical command-lines which causes lld to balk (#17962).
To avoid this we introduce a new tool setting into GHC, -pgmlm, which is
the linker which we use to merge object files.
Diffstat (limited to 'compiler/GHC/SysTools/Tasks.hs')
-rw-r--r-- | compiler/GHC/SysTools/Tasks.hs | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/compiler/GHC/SysTools/Tasks.hs b/compiler/GHC/SysTools/Tasks.hs index 794a12b913..f9962284f9 100644 --- a/compiler/GHC/SysTools/Tasks.hs +++ b/compiler/GHC/SysTools/Tasks.hs @@ -1,4 +1,5 @@ {-# LANGUAGE ScopedTypeVariables #-} +{-# LANGUAGE CPP #-} ----------------------------------------------------------------------------- -- -- Tasks running external programs for SysTools @@ -299,6 +300,20 @@ ld: warning: symbol referencing errors ld_postfix = tail . snd . ld_warn_break ld_warning_found = not . null . snd . ld_warn_break +-- See Note [Merging object files for GHCi] in GHC.Driver.Pipeline. +runMergeObjects :: DynFlags -> [Option] -> IO () +runMergeObjects dflags args = traceToolCommand dflags "merge-objects" $ do + let (p,args0) = pgm_lm dflags + optl_args = map Option (getOpts dflags opt_lm) + args2 = args0 ++ args ++ optl_args + -- N.B. Darwin's ld64 doesn't support response files. Consequently we only + -- use them on Windows where they are truly necessary. +#if defined(mingw32_HOST_OS) + mb_env <- getGccEnv args2 + runSomethingResponseFile dflags id "Merge objects" p args2 mb_env +#else + runSomething dflags "Merge objects" p args2 +#endif runLibtool :: DynFlags -> [Option] -> IO () runLibtool dflags args = traceToolCommand dflags "libtool" $ do |