summaryrefslogtreecommitdiff
path: root/compiler/GHC/Settings
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2020-08-01 11:34:32 -0400
committerMarge Bot <ben+marge-bot@smart-cactus.org>2020-08-05 04:00:39 -0400
commit53ce0db5a06598c88c6b8cb32043b878e7083dd4 (patch)
tree281c045c9f198c5bb046780881931b41de1f15d4 /compiler/GHC/Settings
parent2bff2f87e43985e02bdde8c6fa39279df86cb617 (diff)
downloadhaskell-53ce0db5a06598c88c6b8cb32043b878e7083dd4.tar.gz
Refactor handling of object merging
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/Settings')
-rw-r--r--compiler/GHC/Settings/IO.hs4
1 files changed, 4 insertions, 0 deletions
diff --git a/compiler/GHC/Settings/IO.hs b/compiler/GHC/Settings/IO.hs
index d1ec388195..a3479ca2b5 100644
--- a/compiler/GHC/Settings/IO.hs
+++ b/compiler/GHC/Settings/IO.hs
@@ -137,6 +137,8 @@ initSettings top_dir = do
as_args = map Option cc_args
ld_prog = cc_prog
ld_args = map Option (cc_args ++ words cc_link_args_str)
+ ld_r_prog <- getSetting "Merge objects command"
+ ld_r_args <- getSetting "Merge objects flags"
llvmTarget <- getSetting "LLVM target"
@@ -183,6 +185,7 @@ initSettings top_dir = do
, toolSettings_pgm_c = cc_prog
, toolSettings_pgm_a = (as_prog, as_args)
, toolSettings_pgm_l = (ld_prog, ld_args)
+ , toolSettings_pgm_lm = (ld_r_prog, map Option $ words ld_r_args)
, toolSettings_pgm_dll = (mkdll_prog,mkdll_args)
, toolSettings_pgm_T = touch_path
, toolSettings_pgm_windres = windres_path
@@ -201,6 +204,7 @@ initSettings top_dir = do
, toolSettings_opt_cxx = cxx_args
, toolSettings_opt_a = []
, toolSettings_opt_l = []
+ , toolSettings_opt_lm = []
, toolSettings_opt_windres = []
, toolSettings_opt_lcc = []
, toolSettings_opt_lo = []