public inbox for linux-kbuild@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] kbuild: add GCC stability warning
@ 2026-03-29 19:21 Samuel Rowberry
  2026-03-29 19:44 ` Nicolas Schier
  0 siblings, 1 reply; 3+ messages in thread
From: Samuel Rowberry @ 2026-03-29 19:21 UTC (permalink / raw)
  To: masahiroy; +Cc: nathan, nicolas, linux-kbuild, linux-kernel, Samuel Rowberry

Newer GCC versions are not fully compatible with the code.
Adding a warning lets users know without getting in the way
of setups where it is okay to use GCC 15 (or is needed.)

Signed-off-by: Samuel Rowberry <sprowdev@gmail.com>
---
v2:
 - Fixed line wrapping in commit desc

 Makefile | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/Makefile b/Makefile
index 02902bcae..361b5a509 100644
--- a/Makefile
+++ b/Makefile
@@ -720,6 +720,19 @@ endif
 
 export KBUILD_MODULES KBUILD_BUILTIN
 
+# Version check on demand because configs can get stale
+# This check is GCC-only because that is standard
+# and if someone is using a custom setup, then it is
+# assumed that their setup works.
+ifeq ($(KBUILD_BUILTIN)$(KBUILD_MODULES),11)
+ifneq ($(findstring GCC,$(CC_VERSION_TEXT)),)
+CURRENT_CC_VERSION := $(shell $(CC) -dumpversion | cut -d. -f1)
+ifeq ($(shell expr $(CURRENT_CC_VERSION) \>= 15),1)
+$(warning "GCC $(CURRENT_CC_VERSION) detected. Please use GCC 11, 12, or 13 for stability.")
+endif
+endif
+endif
+
 ifdef need-config
 include include/config/auto.conf
 endif
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] kbuild: add GCC stability warning
  2026-03-29 19:21 [PATCH v2] kbuild: add GCC stability warning Samuel Rowberry
@ 2026-03-29 19:44 ` Nicolas Schier
  2026-03-30  5:43   ` Nathan Chancellor
  0 siblings, 1 reply; 3+ messages in thread
From: Nicolas Schier @ 2026-03-29 19:44 UTC (permalink / raw)
  To: Samuel Rowberry; +Cc: masahiroy, nathan, linux-kbuild, linux-kernel

Hi Samuel,

On Sun, Mar 29, 2026 at 01:21:39PM -0600, Samuel Rowberry wrote:
> Newer GCC versions are not fully compatible with the code.
> Adding a warning lets users know without getting in the way
> of setups where it is okay to use GCC 15 (or is needed.)

can you please elaborate, _why_ you state that gcc 15 is incompatible in
some ways?

> 
> Signed-off-by: Samuel Rowberry <sprowdev@gmail.com>
> ---
> v2:
>  - Fixed line wrapping in commit desc
> 
>  Makefile | 13 +++++++++++++
>  1 file changed, 13 insertions(+)
> 
> diff --git a/Makefile b/Makefile
> index 02902bcae..361b5a509 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -720,6 +720,19 @@ endif
>  
>  export KBUILD_MODULES KBUILD_BUILTIN
>  
> +# Version check on demand because configs can get stale

kbuild already warns on compiler changes between kernel and out-of-tree
module builds, cp. Makefile target 'prepare'.

> +# This check is GCC-only because that is standard
> +# and if someone is using a custom setup, then it is
> +# assumed that their setup works.
> +ifeq ($(KBUILD_BUILTIN)$(KBUILD_MODULES),11)
> +ifneq ($(findstring GCC,$(CC_VERSION_TEXT)),)

What about CONFIG_CC_IS_GCC ?  Or ...

> +CURRENT_CC_VERSION := $(shell $(CC) -dumpversion | cut -d. -f1)

CONFIG_GCC_VERSION ?

> +ifeq ($(shell expr $(CURRENT_CC_VERSION) \>= 15),1)

ifeq ($(call gcc-min-version, $(CONFIG_GCC_VERSION)),y)   ?

> +$(warning "GCC $(CURRENT_CC_VERSION) detected. Please use GCC 11, 12, or 13 for stability.")

Why do you leave out gcc-14 here?

Kind regards

-- 
Nicolas

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] kbuild: add GCC stability warning
  2026-03-29 19:44 ` Nicolas Schier
@ 2026-03-30  5:43   ` Nathan Chancellor
  0 siblings, 0 replies; 3+ messages in thread
From: Nathan Chancellor @ 2026-03-30  5:43 UTC (permalink / raw)
  To: Nicolas Schier; +Cc: Samuel Rowberry, masahiroy, linux-kbuild, linux-kernel

On Sun, Mar 29, 2026 at 09:44:28PM +0200, Nicolas Schier wrote:
> Hi Samuel,
> 
> On Sun, Mar 29, 2026 at 01:21:39PM -0600, Samuel Rowberry wrote:
> > Newer GCC versions are not fully compatible with the code.
> > Adding a warning lets users know without getting in the way
> > of setups where it is okay to use GCC 15 (or is needed.)
> 
> can you please elaborate, _why_ you state that gcc 15 is incompatible in
> some ways?

Yeah, I don't think we should have something like this. GCC 15 works
perfectly fine for me and many others, so this warning will just be
noise for no purpose. If there is a problem you are seeing with GCC 15,
we should address it, not just say amorphously that there may be
incompatibilities. Same goes for any GCC version really.

Cheers,
Nathan

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-03-30  5:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-29 19:21 [PATCH v2] kbuild: add GCC stability warning Samuel Rowberry
2026-03-29 19:44 ` Nicolas Schier
2026-03-30  5:43   ` Nathan Chancellor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox