summaryrefslogtreecommitdiff
path: root/hadrian/src/Flavour.hs
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2022-12-12 19:19:24 -0500
committerMatthew Pickering <matthewtpickering@gmail.com>2023-01-06 15:32:27 +0000
commit246176a04df90f909fba4b149be37973a03a5aea (patch)
treefe1e3887015eb9723a43996aca02ff88fa9dd233 /hadrian/src/Flavour.hs
parentb11a41118a579f4a126a6c1a7ae4e6f728ea1a72 (diff)
downloadhaskell-246176a04df90f909fba4b149be37973a03a5aea.tar.gz
hadrian: Ensure that linker scripts are used when merging objects
In #22527 @rui314 inadvertantly pointed out a glaring bug in Hadrian's implementation of the object merging rules: unlike the old `make` build system we utterly failed to pass the needed linker scripts. Fix this. (cherry picked from commit 6d7d4393e15a6d0a2b42ec986ec6bd3df27baaa7)
Diffstat (limited to 'hadrian/src/Flavour.hs')
-rw-r--r--hadrian/src/Flavour.hs8
1 files changed, 6 insertions, 2 deletions
diff --git a/hadrian/src/Flavour.hs b/hadrian/src/Flavour.hs
index 9c28397b31..f1e4aba881 100644
--- a/hadrian/src/Flavour.hs
+++ b/hadrian/src/Flavour.hs
@@ -193,8 +193,12 @@ splitSectionsIf pkgPredicate = addArgs $ do
pkg <- getPackage
osx <- expr isOsxTarget
not osx ? -- osx doesn't support split sections
- pkgPredicate pkg ? -- Only apply to these packages
- builder (Ghc CompileHs) ? arg "-split-sections"
+ pkgPredicate pkg ? mconcat -- Only apply to these packages
+ [ builder (Ghc CompileHs) ? arg "-split-sections"
+ , builder MergeObjects ? ifM (expr isWinTarget)
+ (pure ["-t", "driver/utils/merge_sections_pe.ld"])
+ (pure ["-t", "driver/utils/merge_sections.ld"])
+ ]
-- | Like 'splitSectionsIf', but with a fixed predicate: use
-- split sections for all packages but the GHC library.