Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC
Commits:
e22ad997 by Cheng Shao at 2026-06-30T21:39:43-04:00
hadrian/rts: fix unregisterised build for gcc 15+
This patch fixes unregisterised build for gcc 15+:
- Pass -optc-Wno-error in hadrian when +werror enables -optc-Werror,
see added comment for details.
- For RTS functions that the codegen would emit calls, ensure their
real prototype is hidden when the header is included in .hc fies
(IN_STG_CODE), and the dummy prototype is provided to match the EFF_
convention.
In the future we should get rid of EFF_ (#14647) and remove these
hacks, but for now this patch makes unregisterised work again on newer
toolchains. Fixes #27404.
Co-authored-by: Codex
- - - - -
4 changed files:
- + changelog.d/fix-unreg
- hadrian/src/Flavour.hs
- rts/include/rts/NonMoving.h
- rts/include/stg/MiscClosures.h
Changes:
=====================================
changelog.d/fix-unreg
=====================================
@@ -0,0 +1,4 @@
+section: packaging
+synopsis: Fix unregisterised build for gcc 15+
+issues: #27404
+mrs: !16264
=====================================
hadrian/src/Flavour.hs
=====================================
@@ -35,7 +35,9 @@ import Data.Either
import Data.Map (Map)
import qualified Data.Map as M
import qualified Data.Set as Set
+import GHC.Toolchain.Target
import Oracles.Flag
+import Oracles.Setting
import Packages
import Flavour.Type
import Settings.Parser
@@ -140,8 +142,9 @@ addArgs args' fl = fl { extraArgs = extraArgs fl <> args' }
-- in unix and/or hsc2hs to make cross-compiling unix completely free
-- from warnings.
werror :: Flavour -> Flavour
-werror =
- addArgs $ mconcat
+werror = addArgs $ do
+ stage <- getStage
+ mconcat
[ builder Ghc
? notStage0
? mconcat
@@ -159,6 +162,15 @@ werror =
, arg "-optc-Wno-error=unknown-pragmas"
-- rejected inlinings are highly dependent upon toolchain and way
, arg "-optc-Wno-error=inline"
+ -- when building unregisterised, gcc 15+ complains "error:
+ -- function called through a non-compatible type" with
+ -- -Werror (#27404). no corresponding -Wno-foo for it so
+ -- -Wno-error is needed.
+ --
+ -- TODO: get rid of EFF_ altogether (#14647) and make sure
+ -- unregisterised backend emits clean C without needing
+ -- these hacks.
+ , queryTargetTarget stage tgtUnregisterised ? arg "-optc-Wno-error"
]
-- N.B. We currently don't build the boot libraries' C sources with -Werror
-- as this tends to be a portability nightmare.
=====================================
rts/include/rts/NonMoving.h
=====================================
@@ -18,6 +18,14 @@ struct StgClosure_;
struct StgThunk_;
struct Capability_;
+#if IN_STG_CODE
+
+EFF_(updateRemembSetPushClosure_);
+
+EFF_(updateRemembSetPushThunk_);
+
+#else
+
/* This is called by the code generator */
extern
void updateRemembSetPushClosure_(StgRegTable *reg, struct StgClosure_ *p);
@@ -25,6 +33,8 @@ void updateRemembSetPushClosure_(StgRegTable *reg, struct StgClosure_ *p);
extern
void updateRemembSetPushThunk_(StgRegTable *reg, struct StgThunk_ *p);
+#endif
+
// Forward declaration for unregisterised backend.
EF_(stg_copyArray_barrier);
=====================================
rts/include/stg/MiscClosures.h
=====================================
@@ -617,7 +617,11 @@ extern StgWord CCS_SYSTEM[];
// 'GHC.StgToCmm.Prof'
// as opposed to real prototype declared in
// 'rts/include/rts/prof/CCS.h'
+#if IN_STG_CODE
+EFF_(enterFunCCS);
+#else
void enterFunCCS (void *reg, void *ccsfn);
+#endif
void * pushCostCentre (void *ccs, void *cc);
// Capability.c
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/e22ad9972091e29ae56ed77686d3c8f1...
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/e22ad9972091e29ae56ed77686d3c8f1...
You're receiving this email because of your account on gitlab.haskell.org.