Re: [PATCH v2] kbuild: add GCC stability warning

From: Nicolas Schier

Date: Sun Mar 29 2026 - 16:12:08 EST


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@xxxxxxxxx>
> ---
> 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