* Build error in next-20260223 gcc-plugins/latent_entropy_plugin.so
@ 2026-02-25 5:20 Valdis Klētnieks
2026-02-25 7:33 ` Kees Cook
0 siblings, 1 reply; 7+ messages in thread
From: Valdis Klētnieks @ 2026-02-25 5:20 UTC (permalink / raw)
To: Kees Cook; +Cc: linux-hardening, linux-kernel
Building next-20260223 dies an early death:
HOSTLD arch/x86/tools/relocs
HOSTCC arch/x86/tools/vdso2c
HOSTCXX scripts/gcc-plugins/latent_entropy_plugin.so
In file included from scripts/gcc-plugins/latent_entropy_plugin.c:78:
scripts/gcc-plugins/gcc-common.h: In function 'void debug_tree(const_tree)':
scripts/gcc-plugins/gcc-common.h:417:20: error: 'CONST_CAST_TREE' was not declared in this scope; did you mean 'CONST_CAST_EXPR'?
417 | debug_tree(CONST_CAST_TREE(t));
| ^~~~~~~~~~~~~~~
| CONST_CAST_EXPR
scripts/gcc-plugins/gcc-common.h: In function 'void debug_gimple_stmt(const_gimple_ptr)':
scripts/gcc-plugins/gcc-common.h:312:47: error: expected primary-expression before ',' token
312 | #define CONST_CAST_GIMPLE(X) CONST_CAST(gimple, (X))
| ^
scripts/gcc-plugins/gcc-common.h:422:27: note: in expansion of macro 'CONST_CAST_GIMPLE'
422 | debug_gimple_stmt(CONST_CAST_GIMPLE(s));
| ^~~~~~~~~~~~~~~~~
scripts/gcc-plugins/gcc-common.h:312:30: error: 'CONST_CAST' was not declared in this scope; did you mean 'CONST_INT'?
312 | #define CONST_CAST_GIMPLE(X) CONST_CAST(gimple, (X))
| ^~~~~~~~~~
scripts/gcc-plugins/gcc-common.h:422:27: note: in expansion of macro 'CONST_CAST_GIMPLE'
422 | debug_gimple_stmt(CONST_CAST_GIMPLE(s));
| ^~~~~~~~~~~~~~~~~
make[3]: *** [scripts/gcc-plugins/Makefile:54: scripts/gcc-plugins/latent_entropy_plugin.so] Error 1
make[2]: *** [scripts/Makefile.build:546: scripts/gcc-plugins] Error 2
make[1]: *** [/usr/src/linux-next/Makefile:1316: scripts] Error 2
make: *** [Makefile:248: __sub-make] Error 2
'git blame' isn't showing any recent changes..
next-20260109 built OK. Any ideas before I start bisecting in more detail?
\0\0\0\0\0\0\0\0
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Build error in next-20260223 gcc-plugins/latent_entropy_plugin.so
2026-02-25 5:20 Build error in next-20260223 gcc-plugins/latent_entropy_plugin.so Valdis Klētnieks
@ 2026-02-25 7:33 ` Kees Cook
2026-02-25 15:14 ` Valdis Klētnieks
0 siblings, 1 reply; 7+ messages in thread
From: Kees Cook @ 2026-02-25 7:33 UTC (permalink / raw)
To: Valdis Klētnieks; +Cc: linux-hardening, linux-kernel
On Wed, Feb 25, 2026 at 12:20:01AM -0500, Valdis Klētnieks wrote:
> Building next-20260223 dies an early death:
>
> HOSTLD arch/x86/tools/relocs
> HOSTCC arch/x86/tools/vdso2c
> HOSTCXX scripts/gcc-plugins/latent_entropy_plugin.so
> In file included from scripts/gcc-plugins/latent_entropy_plugin.c:78:
> scripts/gcc-plugins/gcc-common.h: In function 'void debug_tree(const_tree)':
> scripts/gcc-plugins/gcc-common.h:417:20: error: 'CONST_CAST_TREE' was not declared in this scope; did you mean 'CONST_CAST_EXPR'?
> 417 | debug_tree(CONST_CAST_TREE(t));
> | ^~~~~~~~~~~~~~~
> | CONST_CAST_EXPR
> scripts/gcc-plugins/gcc-common.h: In function 'void debug_gimple_stmt(const_gimple_ptr)':
> scripts/gcc-plugins/gcc-common.h:312:47: error: expected primary-expression before ',' token
> 312 | #define CONST_CAST_GIMPLE(X) CONST_CAST(gimple, (X))
> | ^
> scripts/gcc-plugins/gcc-common.h:422:27: note: in expansion of macro 'CONST_CAST_GIMPLE'
> 422 | debug_gimple_stmt(CONST_CAST_GIMPLE(s));
> | ^~~~~~~~~~~~~~~~~
> scripts/gcc-plugins/gcc-common.h:312:30: error: 'CONST_CAST' was not declared in this scope; did you mean 'CONST_INT'?
> 312 | #define CONST_CAST_GIMPLE(X) CONST_CAST(gimple, (X))
> | ^~~~~~~~~~
> scripts/gcc-plugins/gcc-common.h:422:27: note: in expansion of macro 'CONST_CAST_GIMPLE'
> 422 | debug_gimple_stmt(CONST_CAST_GIMPLE(s));
> | ^~~~~~~~~~~~~~~~~
> make[3]: *** [scripts/gcc-plugins/Makefile:54: scripts/gcc-plugins/latent_entropy_plugin.so] Error 1
> make[2]: *** [scripts/Makefile.build:546: scripts/gcc-plugins] Error 2
> make[1]: *** [/usr/src/linux-next/Makefile:1316: scripts] Error 2
> make: *** [Makefile:248: __sub-make] Error 2
>
> 'git blame' isn't showing any recent changes..
>
> next-20260109 built OK. Any ideas before I start bisecting in more detail?
>
> ????????
Which GCC version?
--
Kees Cook
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Build error in next-20260223 gcc-plugins/latent_entropy_plugin.so
2026-02-25 7:33 ` Kees Cook
@ 2026-02-25 15:14 ` Valdis Klētnieks
2026-03-14 13:50 ` Ingo Saitz
0 siblings, 1 reply; 7+ messages in thread
From: Valdis Klētnieks @ 2026-02-25 15:14 UTC (permalink / raw)
To: Kees Cook; +Cc: linux-hardening, linux-kernel
On Tue, 24 Feb 2026 23:33:32 -0800, Kees Cook said:
>
> Which GCC version?
Oh nuts. I thought I included that.. Dug into it more, looks like a GCC
bug rather than a kernel bug.
From the gcc RPM changelog:
This one works.
* Tue Jan 27 2026 Jakub Jelinek <jakub@redhat.com> 16.0.1-0.5
- update from trunk
This doesn't:
* Mon Feb 09 2026 Jakub Jelinek <jakub@redhat.com> 16.0.1-0.7
- update from trunk
\0\0\0\0\0\0\0\0
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Build error in next-20260223 gcc-plugins/latent_entropy_plugin.so
2026-02-25 15:14 ` Valdis Klētnieks
@ 2026-03-14 13:50 ` Ingo Saitz
2026-03-14 14:44 ` Ingo Saitz
0 siblings, 1 reply; 7+ messages in thread
From: Ingo Saitz @ 2026-03-14 13:50 UTC (permalink / raw)
To: Valdis Klētnieks; +Cc: Kees Cook, linux-hardening, linux-kernel
I get the same error with
gcc (Debian 16-20260308-1) 16.0.1 20260308 (experimental) [trunk r16-7949-g6c5de6335f5]
It seems gcc removed the CONST_CAST macros in gcc-16. CONST_CAST_TREE
got removed in commit c3d96ff, CONST_CAST in commit 458c792.
https://github.com/gcc-mirror/gcc/commit/c3d96ff9e916c02584aa081f03ab999292efbb50
https://github.com/gcc-mirror/gcc/commit/458c7926d48959abcb2c1adaa22458e27459a551
So this does not seem to be a gcc bug, but the CONST_CAST macros being
gone for good.
I attached a quick patch to get the kernel build with the current gcc-16
development version, but it still needs to be guarded against different
gcc versions.
Ingo
--
const_cast<long double>(Λ)
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Build error in next-20260223 gcc-plugins/latent_entropy_plugin.so
2026-03-14 13:50 ` Ingo Saitz
@ 2026-03-14 14:44 ` Ingo Saitz
2026-03-20 19:23 ` Kees Cook
0 siblings, 1 reply; 7+ messages in thread
From: Ingo Saitz @ 2026-03-14 14:44 UTC (permalink / raw)
To: Valdis Klētnieks; +Cc: Kees Cook, linux-hardening, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 140 bytes --]
On Sat, Mar 14, 2026 at 02:50:46PM +0100, Ingo Saitz wrote:
> I attached [...]
Grml, here you go
Ingo
--
const_cast<long double>(Λ)
[-- Attachment #2: 0001-Replace-CONST_CAST-with-const_cast.patch --]
[-- Type: text/x-diff, Size: 1671 bytes --]
From 552485b879d19780afd3614d69508c3ea7cb242f Mon Sep 17 00:00:00 2001
From: Ingo Saitz <ingo@hannover.ccc.de>
Date: Sat, 14 Mar 2026 14:24:56 +0100
Subject: [PATCH] Replace CONST_CAST with const_cast<>.
For gcc-16, this was removed in gcc trunk
see commits
c3d96ff9e916c02584aa081f03ab999292efbb50
458c7926d48959abcb2c1adaa22458e27459a551
---
scripts/gcc-plugins/gcc-common.h | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/scripts/gcc-plugins/gcc-common.h b/scripts/gcc-plugins/gcc-common.h
index 8f1b3500f8e2..7b3517b31e0a 100644
--- a/scripts/gcc-plugins/gcc-common.h
+++ b/scripts/gcc-plugins/gcc-common.h
@@ -309,7 +309,7 @@ typedef const gimple *const_gimple_ptr;
#define gimple gimple_ptr
#define const_gimple const_gimple_ptr
#undef CONST_CAST_GIMPLE
-#define CONST_CAST_GIMPLE(X) CONST_CAST(gimple, (X))
+#define CONST_CAST_GIMPLE(X) const_cast<gimple>((X))
/* gimple related */
static inline gimple gimple_build_assign_with_ops(enum tree_code subcode, tree lhs, tree op1, tree op2 MEM_STAT_DECL)
@@ -414,7 +414,7 @@ static inline void ipa_remove_stmt_references(symtab_node *referring_node, gimpl
#ifdef __cplusplus
static inline void debug_tree(const_tree t)
{
- debug_tree(CONST_CAST_TREE(t));
+ debug_tree(const_cast<tree>(t));
}
static inline void debug_gimple_stmt(const_gimple s)
@@ -422,7 +422,7 @@ static inline void debug_gimple_stmt(const_gimple s)
debug_gimple_stmt(CONST_CAST_GIMPLE(s));
}
#else
-#define debug_tree(t) debug_tree(CONST_CAST_TREE(t))
+#define debug_tree(t) debug_tree(const_cast<tree>(t))
#define debug_gimple_stmt(s) debug_gimple_stmt(CONST_CAST_GIMPLE(s))
#endif
--
2.53.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: Build error in next-20260223 gcc-plugins/latent_entropy_plugin.so
2026-03-14 14:44 ` Ingo Saitz
@ 2026-03-20 19:23 ` Kees Cook
2026-03-21 12:25 ` Ingo Saitz
0 siblings, 1 reply; 7+ messages in thread
From: Kees Cook @ 2026-03-20 19:23 UTC (permalink / raw)
To: Ingo Saitz; +Cc: Valdis Klētnieks, linux-hardening, linux-kernel
On Sat, Mar 14, 2026 at 03:44:08PM +0100, Ingo Saitz wrote:
> On Sat, Mar 14, 2026 at 02:50:46PM +0100, Ingo Saitz wrote:
> > I attached [...]
>
> Grml, here you go
>
> Ingo
> --
> const_cast<long double>(Λ)
> From 552485b879d19780afd3614d69508c3ea7cb242f Mon Sep 17 00:00:00 2001
> From: Ingo Saitz <ingo@hannover.ccc.de>
> Date: Sat, 14 Mar 2026 14:24:56 +0100
> Subject: [PATCH] Replace CONST_CAST with const_cast<>.
>
> For gcc-16, this was removed in gcc trunk
>
> see commits
> c3d96ff9e916c02584aa081f03ab999292efbb50
> 458c7926d48959abcb2c1adaa22458e27459a551
> ---
> scripts/gcc-plugins/gcc-common.h | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/scripts/gcc-plugins/gcc-common.h b/scripts/gcc-plugins/gcc-common.h
> index 8f1b3500f8e2..7b3517b31e0a 100644
> --- a/scripts/gcc-plugins/gcc-common.h
> +++ b/scripts/gcc-plugins/gcc-common.h
> @@ -309,7 +309,7 @@ typedef const gimple *const_gimple_ptr;
> #define gimple gimple_ptr
> #define const_gimple const_gimple_ptr
> #undef CONST_CAST_GIMPLE
> -#define CONST_CAST_GIMPLE(X) CONST_CAST(gimple, (X))
> +#define CONST_CAST_GIMPLE(X) const_cast<gimple>((X))
>
> /* gimple related */
> static inline gimple gimple_build_assign_with_ops(enum tree_code subcode, tree lhs, tree op1, tree op2 MEM_STAT_DECL)
> @@ -414,7 +414,7 @@ static inline void ipa_remove_stmt_references(symtab_node *referring_node, gimpl
> #ifdef __cplusplus
> static inline void debug_tree(const_tree t)
> {
> - debug_tree(CONST_CAST_TREE(t));
> + debug_tree(const_cast<tree>(t));
> }
>
> static inline void debug_gimple_stmt(const_gimple s)
> @@ -422,7 +422,7 @@ static inline void debug_gimple_stmt(const_gimple s)
> debug_gimple_stmt(CONST_CAST_GIMPLE(s));
> }
> #else
> -#define debug_tree(t) debug_tree(CONST_CAST_TREE(t))
> +#define debug_tree(t) debug_tree(const_cast<tree>(t))
> #define debug_gimple_stmt(s) debug_gimple_stmt(CONST_CAST_GIMPLE(s))
> #endif
Thanks for this!
Should CONST_CAST_TREE be explicitly defined instead, to match
CONST_CAST_GIMPLE in the this header file? It seems weird to have one of
two done this way: we should either do both or neither (CONST_CAST_GIMPLE
is only used in the header file too).
Is const_cast<gimple> and const_cast<tree> valid back through GCC 8
(earliest Linux-supported GCC)?
-Kees
--
Kees Cook
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Build error in next-20260223 gcc-plugins/latent_entropy_plugin.so
2026-03-20 19:23 ` Kees Cook
@ 2026-03-21 12:25 ` Ingo Saitz
0 siblings, 0 replies; 7+ messages in thread
From: Ingo Saitz @ 2026-03-21 12:25 UTC (permalink / raw)
To: Kees Cook
Cc: Ingo Saitz, Valdis Klētnieks, linux-hardening, linux-kernel
On Fri, Mar 20, 2026 at 12:23:10PM -0700, Kees Cook wrote:
> Thanks for this!
>
> Should CONST_CAST_TREE be explicitly defined instead, to match
> CONST_CAST_GIMPLE in the this header file? It seems weird to have one of
> two done this way: we should either do both or neither (CONST_CAST_GIMPLE
> is only used in the header file too).
My first idea was to simplay guard this depending on the gcc version,
since the CONST_CAST_TREE type changed from (union tree_node *) to tree.
But the typedef union tree_node *tree (in gcc source: gcc/coretypes.h)
is already there in gcc-8, and const_cast is an old c++ feature.
> Is const_cast<gimple> and const_cast<tree> valid back through GCC 8
> (earliest Linux-supported GCC)?
I successfully compiled and booted linux 6.19.8 with my patch applied
with gcc-8 (Debian 8.3.0-7) 8.3.0, so it think this patch does work with
all supported gcc versions and a guard is not needed indeed.
I tried to minimize the changes, since I don't really know how gcc
plugins actually work. But changing CONST_CAST_GIMPLE to
const_cast<gimple>, too, should not fail since that's now a simple text
replacement.
Ingo
--
const_cast<long double>(Λ)
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2026-03-21 12:25 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-25 5:20 Build error in next-20260223 gcc-plugins/latent_entropy_plugin.so Valdis Klētnieks
2026-02-25 7:33 ` Kees Cook
2026-02-25 15:14 ` Valdis Klētnieks
2026-03-14 13:50 ` Ingo Saitz
2026-03-14 14:44 ` Ingo Saitz
2026-03-20 19:23 ` Kees Cook
2026-03-21 12:25 ` Ingo Saitz
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox