Sven Tennie pushed to branch wip/romes/hadrian-cross-stage2-rebase_SVEN_FIXED at Glasgow Haskell Compiler / GHC

Commits:

1 changed file:

Changes:

  • hadrian/src/Rules/Generate.hs
    ... ... @@ -26,6 +26,7 @@ import BindistConfig
    26 26
     import GHC.Toolchain as Toolchain hiding (HsCpp(HsCpp))
    
    27 27
     import GHC.Platform.ArchOS
    
    28 28
     import qualified Data.Set as Set
    
    29
    +import UserSettings (finalStage)
    
    29 30
     
    
    30 31
     -- | Track this file to rebuild generated files whenever it changes.
    
    31 32
     trackGenerateHs :: Expr ()
    
    ... ... @@ -256,7 +257,12 @@ generateRules = do
    256 257
     
    
    257 258
         forM_ allStages $ \stage -> do
    
    258 259
             let prefix = root -/- stageString stage -/- "lib"
    
    259
    -            go gen file = generate file (semiEmptyTarget (succStage stage)) gen
    
    260
    +            -- For the finalStage, we generate settings for that stage. For
    
    261
    +            -- others we look at the next stage. Why? Because cross-compilers
    
    262
    +            -- require libs from the successor stage, otherwise they are
    
    263
    +            -- compiled for the host and not the target.
    
    264
    +            stage' = if stage /= finalStage then succStage stage else stage
    
    265
    +            go gen file = generate file (semiEmptyTarget stage') gen
    
    260 266
             (prefix -/- "settings") %> \out -> go (generateSettings out) out
    
    261 267
             -- The compiler in `_build/stage1/` is the stage2 compiler, thus we have to query for "stage from path" + 1
    
    262 268
             (prefix -/- "targets" -/- "default.target") %> \out -> go (show <$> expr (targetStage (succStage stage))) out