Cheng Shao pushed to branch wip/fix-unreg at Glasgow Haskell Compiler / GHC

Commits:

4 changed files:

Changes:

  • changelog.d/fix-unreg
    1
    +section: packaging
    
    2
    +synopsis: Fix unregisterised build for gcc 15+
    
    3
    +issues: #27404
    
    4
    +mrs: !16264

  • hadrian/src/Flavour.hs
    ... ... @@ -35,7 +35,9 @@ import Data.Either
    35 35
     import Data.Map (Map)
    
    36 36
     import qualified Data.Map as M
    
    37 37
     import qualified Data.Set as Set
    
    38
    +import GHC.Toolchain.Target
    
    38 39
     import Oracles.Flag
    
    40
    +import Oracles.Setting
    
    39 41
     import Packages
    
    40 42
     import Flavour.Type
    
    41 43
     import Settings.Parser
    
    ... ... @@ -140,8 +142,9 @@ addArgs args' fl = fl { extraArgs = extraArgs fl <> args' }
    140 142
     -- in unix and/or hsc2hs to make cross-compiling unix completely free
    
    141 143
     -- from warnings.
    
    142 144
     werror :: Flavour -> Flavour
    
    143
    -werror =
    
    144
    -  addArgs $ mconcat
    
    145
    +werror = addArgs $ do
    
    146
    +  stage <- getStage
    
    147
    +  mconcat
    
    145 148
         [ builder Ghc
    
    146 149
             ? notStage0
    
    147 150
             ? mconcat
    
    ... ... @@ -159,6 +162,15 @@ werror =
    159 162
               , arg "-optc-Wno-error=unknown-pragmas"
    
    160 163
                 -- rejected inlinings are highly dependent upon toolchain and way
    
    161 164
               , arg "-optc-Wno-error=inline"
    
    165
    +            -- when building unregisterised, gcc 15+ complains "error:
    
    166
    +            -- function called through a non-compatible type" with
    
    167
    +            -- -Werror (#27404). no corresponding -Wno-foo for it so
    
    168
    +            -- -Wno-error is needed.
    
    169
    +            --
    
    170
    +            -- TODO: get rid of EFF_ altogether (#14647) and make sure
    
    171
    +            -- unregisterised backend emits clean C without needing
    
    172
    +            -- these hacks.
    
    173
    +          , queryTargetTarget stage tgtUnregisterised ? arg "-optc-Wno-error"
    
    162 174
               ]
    
    163 175
           -- N.B. We currently don't build the boot libraries' C sources with -Werror
    
    164 176
           -- as this tends to be a portability nightmare.
    

  • rts/include/rts/NonMoving.h
    ... ... @@ -18,6 +18,14 @@ struct StgClosure_;
    18 18
     struct StgThunk_;
    
    19 19
     struct Capability_;
    
    20 20
     
    
    21
    +#if IN_STG_CODE
    
    22
    +
    
    23
    +EFF_(updateRemembSetPushClosure_);
    
    24
    +
    
    25
    +EFF_(updateRemembSetPushThunk_);
    
    26
    +
    
    27
    +#else
    
    28
    +
    
    21 29
     /* This is called by the code generator */
    
    22 30
     extern
    
    23 31
     void updateRemembSetPushClosure_(StgRegTable *reg, struct StgClosure_ *p);
    
    ... ... @@ -25,6 +33,8 @@ void updateRemembSetPushClosure_(StgRegTable *reg, struct StgClosure_ *p);
    25 33
     extern
    
    26 34
     void updateRemembSetPushThunk_(StgRegTable *reg, struct StgThunk_ *p);
    
    27 35
     
    
    36
    +#endif
    
    37
    +
    
    28 38
     // Forward declaration for unregisterised backend.
    
    29 39
     EF_(stg_copyArray_barrier);
    
    30 40
     
    

  • rts/include/stg/MiscClosures.h
    ... ... @@ -617,7 +617,11 @@ extern StgWord CCS_SYSTEM[];
    617 617
     //    'GHC.StgToCmm.Prof'
    
    618 618
     // as opposed to real prototype declared in
    
    619 619
     //    'rts/include/rts/prof/CCS.h'
    
    620
    +#if IN_STG_CODE
    
    621
    +EFF_(enterFunCCS);
    
    622
    +#else
    
    620 623
     void enterFunCCS (void *reg, void *ccsfn);
    
    624
    +#endif
    
    621 625
     void * pushCostCentre (void *ccs, void *cc);
    
    622 626
     
    
    623 627
     // Capability.c