diff options
author | Ben Gamari <ben@smart-cactus.org> | 2022-03-28 12:08:01 -0400 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2022-04-06 13:01:28 -0400 |
commit | d2ae0a3a1a8e31e5d769f1aea95e85793043cb3a (patch) | |
tree | 37951c698d81838d84b4104936371d39e013b4b1 /compiler | |
parent | 295c35c5cfda67c11222f99fb338d3cac52abac1 (diff) | |
download | haskell-d2ae0a3a1a8e31e5d769f1aea95e85793043cb3a.tar.gz |
Build ar archives with -L when "joining" objects
Since there may be .o files which are in fact archives.
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/GHC/Driver/Pipeline/Execute.hs | 4 | ||||
-rw-r--r-- | compiler/GHC/Settings.hs | 4 | ||||
-rw-r--r-- | compiler/GHC/Settings/IO.hs | 2 |
3 files changed, 9 insertions, 1 deletions
diff --git a/compiler/GHC/Driver/Pipeline/Execute.hs b/compiler/GHC/Driver/Pipeline/Execute.hs index 902ef68f3a..8a185bf4ec 100644 --- a/compiler/GHC/Driver/Pipeline/Execute.hs +++ b/compiler/GHC/Driver/Pipeline/Execute.hs @@ -1179,8 +1179,10 @@ joinObjectFiles hsc_env o_files output_fn | otherwise = do withAtomicRename output_fn $ \tmp_ar -> - liftIO $ runAr logger dflags Nothing $ map Option $ ["rc", tmp_ar] ++ o_files + liftIO $ runAr logger dflags Nothing $ map Option $ ["qc" ++ dashL, tmp_ar] ++ o_files where + dashLSupported = sArSupportsDashL (settings dflags) + dashL = if dashLSupported then "L" else "" can_merge_objs = isJust (pgm_lm (hsc_dflags hsc_env)) dflags = hsc_dflags hsc_env tmpfs = hsc_tmpfs hsc_env diff --git a/compiler/GHC/Settings.hs b/compiler/GHC/Settings.hs index 2014a437ca..92bfa75699 100644 --- a/compiler/GHC/Settings.hs +++ b/compiler/GHC/Settings.hs @@ -23,6 +23,7 @@ module GHC.Settings , sLdIsGnuLd , sGccSupportsNoPie , sUseInplaceMinGW + , sArSupportsDashL , sPgm_L , sPgm_P , sPgm_F @@ -91,6 +92,7 @@ data ToolSettings = ToolSettings , toolSettings_ldIsGnuLd :: Bool , toolSettings_ccSupportsNoPie :: Bool , toolSettings_useInplaceMinGW :: Bool + , toolSettings_arSupportsDashL :: Bool -- commands for particular phases , toolSettings_pgm_L :: String @@ -197,6 +199,8 @@ sGccSupportsNoPie :: Settings -> Bool sGccSupportsNoPie = toolSettings_ccSupportsNoPie . sToolSettings sUseInplaceMinGW :: Settings -> Bool sUseInplaceMinGW = toolSettings_useInplaceMinGW . sToolSettings +sArSupportsDashL :: Settings -> Bool +sArSupportsDashL = toolSettings_arSupportsDashL . sToolSettings sPgm_L :: Settings -> String sPgm_L = toolSettings_pgm_L . sToolSettings diff --git a/compiler/GHC/Settings/IO.hs b/compiler/GHC/Settings/IO.hs index 08e60776a3..8e23706410 100644 --- a/compiler/GHC/Settings/IO.hs +++ b/compiler/GHC/Settings/IO.hs @@ -96,6 +96,7 @@ initSettings top_dir = do ldSupportsBuildId <- getBooleanSetting "ld supports build-id" ldSupportsFilelist <- getBooleanSetting "ld supports filelist" ldIsGnuLd <- getBooleanSetting "ld is GNU ld" + arSupportsDashL <- getBooleanSetting "ar supports -L" let globalpkgdb_path = installed "package.conf.d" ghc_usage_msg_path = installed "ghc-usage.txt" @@ -167,6 +168,7 @@ initSettings top_dir = do , toolSettings_ldIsGnuLd = ldIsGnuLd , toolSettings_ccSupportsNoPie = gccSupportsNoPie , toolSettings_useInplaceMinGW = useInplaceMinGW + , toolSettings_arSupportsDashL = arSupportsDashL , toolSettings_pgm_L = unlit_path , toolSettings_pgm_P = (cpp_prog, cpp_args) |