From 53ce0db5a06598c88c6b8cb32043b878e7083dd4 Mon Sep 17 00:00:00 2001 From: Ben Gamari Date: Sat, 1 Aug 2020 11:34:32 -0400 Subject: 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. --- compiler/GHC/Settings/IO.hs | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'compiler/GHC/Settings/IO.hs') 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 = [] -- cgit v1.2.1