[Git][ghc/ghc][wip/hadrian-cross-stage2] fix hsc2hs cross predicate

Matthew Pickering (@mpickering) gitlab at gitlab.haskell.org
Mon Sep 25 11:27:10 UTC 2023



Matthew Pickering pushed to branch wip/hadrian-cross-stage2 at Glasgow Haskell Compiler / GHC


Commits:
ed997787 by GHC GitLab CI at 2023-09-25T11:23:17+00:00
fix hsc2hs cross predicate

- - - - -


1 changed file:

- hadrian/src/Settings/Builders/Hsc2Hs.hs


Changes:

=====================================
hadrian/src/Settings/Builders/Hsc2Hs.hs
=====================================
@@ -21,14 +21,17 @@ hsc2hsBuilderArgs = builder Hsc2Hs ? do
     version <- case stage of
                   Stage0 {} -> expr ghcCanonVersion
                   _ ->  getSetting ProjectVersionInt
+    let cross = case stage of
+                  Stage0 {} -> return False
+                  _ -> expr (crossStage (predStage stage))
     tmpl <- (top -/-) <$> expr (templateHscPath stage0Boot)
     mconcat [ arg $ "--cc=" ++ ccPath
             , arg $ "--ld=" ++ ccPath
-            , notM (isWinTarget stage) ? notM (crossStage stage) ? arg "--cross-safe"
+            , notM (isWinTarget stage) ? notM cross ? arg "--cross-safe"
             , pure $ map ("-I" ++) (words gmpDir)
             , map ("--cflag=" ++) <$> getCFlags
             , map ("--lflag=" ++) <$> getLFlags
-            , notStage0 ? crossStage stage ? arg "--cross-compile"
+            , notStage0 ? cross ? arg "--cross-compile"
             , stage0    ? arg ("--cflag=-D" ++ hArch ++ "_HOST_ARCH=1")
             , stage0    ? arg ("--cflag=-D" ++ hOs   ++ "_HOST_OS=1"  )
             , notStage0 ? arg ("--cflag=-D" ++ tArch ++ "_HOST_ARCH=1")
@@ -42,7 +45,7 @@ hsc2hsBuilderArgs = builder Hsc2Hs ? do
               -- they are constant and end up as constants in the assembly.
               -- See #12849
               -- MP: Wrong use of CrossCompiling
-            , crossStage stage ? isWinTarget stage ? arg "--via-asm"
+            , cross ? isWinTarget stage ? arg "--via-asm"
             , arg =<< getInput
             , arg "-o", arg =<< getOutput ]
 



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

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/ed997787139890b5e669948cd5f98f29ee3dcf60
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/20230925/30a6f9ab/attachment-0001.html>


More information about the ghc-commits mailing list