[Git][ghc/ghc][wip/ghc-toolchain-fixes] Add ldOverrideWhitelist to only default to ldOverride on windows/linux

Matthew Pickering (@mpickering) gitlab at gitlab.haskell.org
Thu Jul 27 14:59:59 UTC 2023



Matthew Pickering pushed to branch wip/ghc-toolchain-fixes at Glasgow Haskell Compiler / GHC


Commits:
fea60d1b by Matthew Pickering at 2023-07-27T15:59:35+01:00
Add ldOverrideWhitelist to only default to ldOverride on windows/linux

- - - - -


1 changed file:

- utils/ghc-toolchain/exe/Main.hs


Changes:

=====================================
utils/ghc-toolchain/exe/Main.hs
=====================================
@@ -309,6 +309,15 @@ archHasNativeAdjustors = \case
   _          -> False
 
 
+-- | The platforms which we attempt to override ld
+ldOverrideWhitelist :: ArchOS -> Bool
+ldOverrideWhitelist a =
+  case archOS_OS a of
+    OSLinux   -> True
+    OSMinGW32 -> True
+    _ -> False
+
+
 mkTarget :: Opts -> M Target
 mkTarget opts = do
     -- Use Llvm target if specified, otherwise use triple as llvm target
@@ -320,7 +329,7 @@ mkTarget opts = do
     (archOs, tgtVendor) <- parseTriple cc0 (optTriple opts)
     cc <- addPlatformDepCcFlags archOs cc0
     readelf <- optional $ findReadelf (optReadelf opts)
-    ccLink <- findCcLink tgtLlvmTarget (optCcLink opts) (fromMaybe True (optLdOverride opts)) archOs cc readelf
+    ccLink <- findCcLink tgtLlvmTarget (optCcLink opts) (fromMaybe (ldOverrideWhitelist archOs) (optLdOverride opts)) archOs cc readelf
 
     ar <- findAr tgtVendor (optAr opts)
     -- TODO: We could have



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

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/fea60d1b02f9332aba8365ac5dfd21924804952c
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/20230727/38ec742c/attachment-0001.html>


More information about the ghc-commits mailing list