Skip to contentSkip to conversation

kbuild: add GCC stability warning

PATCH In review Samuel Rowberry 3 participants 3 messages Mar 29 – Mar 30 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 kbuild: add GCC stability warning

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.)

---
v2:
- Fixed line wrapping in commit desc

 Makefile | 13 +++++++++++++
 1 file changed, 13 insertions(+)
Makefile +13 -0
index 02902bcae..361b5a509 100644
@@ -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
Signature · 1 line
2.53.0
maintainer
#1 lore raw

Hi Samuel,

Quoted 3 lines · 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.)

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

Quoted 14 lines

---
v2:
- Fixed line wrapping in commit desc

 Makefile | 13 +++++++++++++
 1 file changed, 13 insertions(+)
Makefile +0 -0
index 02902bcae..361b5a509 100644

Makefile endif · line 723

Quoted 4 lines
Makefile +1 -0
@@ -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'.

Makefile endif · line 728

Quoted 5 lines
Makefile +5 -0
+# 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 ...

Makefile endif · line 729

Quoted 1 line
Makefile +1 -0
+CURRENT_CC_VERSION := $(shell $(CC) -dumpversion | cut -d. -f1)

CONFIG_GCC_VERSION ?

Makefile endif · line 730

Quoted 1 line
Makefile +1 -0
+ifeq ($(shell expr $(CURRENT_CC_VERSION) \>= 15),1)

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

Makefile endif · line 731

Quoted 1 line
Makefile +1 -0
+$(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

Signature · 1 line
Nicolas
#2 lore raw
Quoted 9 lines · Nicolas Schier

Hi Samuel,

Quoted 3 lines · 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.)

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