[Git][ghc/ghc][wip/T22527] hadrian: Ensure that linker scripts are used when merging objects

Ben Gamari (@bgamari) gitlab at gitlab.haskell.org
Wed Dec 21 21:47:33 UTC 2022



Ben Gamari pushed to branch wip/T22527 at Glasgow Haskell Compiler / GHC


Commits:
896eddd2 by Ben Gamari at 2022-12-21T16:47:28-05:00
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.

- - - - -


1 changed file:

- hadrian/src/Flavour.hs


Changes:

=====================================
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.



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/896eddd21bcc72f0733b2b1a3d4fa59d4b486233

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/896eddd21bcc72f0733b2b1a3d4fa59d4b486233
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20221221/695825dd/attachment.html>


More information about the ghc-commits mailing list