summaryrefslogtreecommitdiff
path: root/hadrian/src/Settings
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2022-03-24 21:00:44 -0400
committerMarge Bot <ben+marge-bot@smart-cactus.org>2022-04-06 13:01:28 -0400
commit3ac80a8609418f9f1e9aa025b182fb3445f14428 (patch)
tree207223dc28b689120628585b3fa0fd3554d1ae5c /hadrian/src/Settings
parent41fcb5cd756f52cd313d90a73f556fa5f3890818 (diff)
downloadhaskell-3ac80a8609418f9f1e9aa025b182fb3445f14428.tar.gz
hadrian: Produce ar archives with L modifier on Windows
Since object files may in fact be archive files, we must ensure that their contents are merged rather than constructing an archive-of-an-archive. See #21068.
Diffstat (limited to 'hadrian/src/Settings')
-rw-r--r--hadrian/src/Settings/Builders/Ar.hs8
1 files changed, 7 insertions, 1 deletions
diff --git a/hadrian/src/Settings/Builders/Ar.hs b/hadrian/src/Settings/Builders/Ar.hs
index a4b08d6358..08379f07f8 100644
--- a/hadrian/src/Settings/Builders/Ar.hs
+++ b/hadrian/src/Settings/Builders/Ar.hs
@@ -8,7 +8,13 @@ import Settings.Builders.Common
arBuilderArgs :: Args
arBuilderArgs = mconcat
[ builder (Ar Pack) ? mconcat
- [ arg "q"
+ [ -- When building on platforms which don't support object merging
+ -- we must use the -L flag supported by llvm-ar, which ensures that
+ -- .a files added to the archive are merged into the resulting archive,
+ -- not added as a single file. This requires that we are using llvm-ar
+ --
+ -- See Note [Object merging] in GHC.Driver.Pipeline.Execute for details.
+ ifM ((&&) <$> notStage0 <*> expr (flag ArSupportsDashL)) (arg "qL") (arg "q")
, arg =<< getOutput
]
, builder (Ar Unpack) ? mconcat