* [PATCH 5.4.y 0/5] v5.4: fix build with GCC 15
@ 2025-10-17 17:33 Matthieu Baerts (NGI0)
2025-10-17 17:33 ` [PATCH 5.4.y 1/5] x86/boot: Use '-std=gnu11' to " Matthieu Baerts (NGI0)
` (5 more replies)
0 siblings, 6 replies; 8+ messages in thread
From: Matthieu Baerts (NGI0) @ 2025-10-17 17:33 UTC (permalink / raw)
To: stable, Greg Kroah-Hartman, Sasha Levin
Cc: MPTCP Upstream, Matthieu Baerts (NGI0), Nathan Chancellor,
Kostadin Shishmanov, Jakub Jelinek, Dave Hansen, Ard Biesheuvel,
Alexey Dobriyan, Ingo Molnar, H. Peter Anvin (Intel),
Arnd Bergmann, Nathan Chancellor, Andrew Morton, Thomas Gleixner,
Linus Torvalds
Two backports linked to build issues with GCC 15 have failed in this
version:
- ee2ab467bddf ("x86/boot: Use '-std=gnu11' to fix build with GCC 15")
- 8ba14d9f490a ("efi: libstub: Use '-std=gnu11' to fix build with GCC 15")
Conflicts have been solved, and described.
After that, this kernel version still didn't build with GCC 15:
In file included from include/uapi/linux/posix_types.h:5,
from include/uapi/linux/types.h:14,
from include/linux/types.h:6,
from arch/x86/realmode/rm/wakeup.h:11,
from arch/x86/realmode/rm/wakemain.c:2:
include/linux/stddef.h:11:9: error: cannot use keyword 'false' as enumeration constant
11 | false = 0,
| ^~~~~
include/linux/stddef.h:11:9: note: 'false' is a keyword with '-std=c23' onwards
include/linux/types.h:30:33: error: 'bool' cannot be defined via 'typedef'
30 | typedef _Bool bool;
| ^~~~
include/linux/types.h:30:33: note: 'bool' is a keyword with '-std=c23' onwards
include/linux/types.h:30:1: warning: useless type name in empty declaration
30 | typedef _Bool bool;
| ^~~~~~~
I initially fixed this by adding -std=gnu11 in arch/x86/Makefile, then I
realised this fix was already done in an upstream commit, created before
the GCC 15 release and not mentioning the error I had. This is patch 3.
When I was investigating my error, I noticed other commits were already
backported to stable versions. They were all adding -std=gnu11 in
different Makefiles. In their commit message, they were mentioning
'gnu11' was picked to use the same as the one from the main Makefile.
But this is not the case in this kernel version. Patch 4 fixes that.
Finally, I noticed extra warnings I didn't have in v5.10. Patch 5 fixes
that.
Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
---
Alexey Dobriyan (1):
x86/boot: Compile boot code with -std=gnu11 too
Matthieu Baerts (NGI0) (1):
arch: back to -std=gnu89 in < v5.18
Nathan Chancellor (3):
x86/boot: Use '-std=gnu11' to fix build with GCC 15
efi: libstub: Use '-std=gnu11' to fix build with GCC 15
kernel/profile.c: use cpumask_available to check for NULL cpumask
arch/parisc/boot/compressed/Makefile | 2 +-
arch/s390/Makefile | 2 +-
arch/s390/purgatory/Makefile | 2 +-
arch/x86/Makefile | 2 +-
arch/x86/boot/compressed/Makefile | 1 +
drivers/firmware/efi/libstub/Makefile | 2 +-
kernel/profile.c | 6 +++---
7 files changed, 9 insertions(+), 8 deletions(-)
---
base-commit: cda7d335d88aa30485536aee3027540f41bf4f10
change-id: 20251017-v5-4-gcc-15-2d2ccb30432c
Best regards,
--
Matthieu Baerts (NGI0) <matttbe@kernel.org>
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 5.4.y 1/5] x86/boot: Use '-std=gnu11' to fix build with GCC 15
2025-10-17 17:33 [PATCH 5.4.y 0/5] v5.4: fix build with GCC 15 Matthieu Baerts (NGI0)
@ 2025-10-17 17:33 ` Matthieu Baerts (NGI0)
2025-10-17 17:33 ` [PATCH 5.4.y 2/5] efi: libstub: " Matthieu Baerts (NGI0)
` (4 subsequent siblings)
5 siblings, 0 replies; 8+ messages in thread
From: Matthieu Baerts (NGI0) @ 2025-10-17 17:33 UTC (permalink / raw)
To: stable, Greg Kroah-Hartman, Sasha Levin
Cc: MPTCP Upstream, Matthieu Baerts (NGI0), Nathan Chancellor,
Kostadin Shishmanov, Jakub Jelinek, Dave Hansen, Ard Biesheuvel
From: Nathan Chancellor <nathan@kernel.org>
commit ee2ab467bddfb2d7f68d996dbab94d7b88f8eaf7 upstream.
GCC 15 changed the default C standard version to C23, which should not
have impacted the kernel because it requests the gnu11 standard via
'-std=' in the main Makefile. However, the x86 compressed boot Makefile
uses its own set of KBUILD_CFLAGS without a '-std=' value (i.e., using
the default), resulting in errors from the kernel's definitions of bool,
true, and false in stddef.h, which are reserved keywords under C23.
./include/linux/stddef.h:11:9: error: expected identifier before ‘false’
11 | false = 0,
./include/linux/types.h:35:33: error: two or more data types in declaration specifiers
35 | typedef _Bool bool;
Set '-std=gnu11' in the x86 compressed boot Makefile to resolve the
error and consistently use the same C standard version for the entire
kernel.
Closes: https://lore.kernel.org/4OAhbllK7x4QJGpZjkYjtBYNLd_2whHx9oFiuZcGwtVR4hIzvduultkgfAIRZI3vQpZylu7Gl929HaYFRGeMEalWCpeMzCIIhLxxRhq4U-Y=@protonmail.com/
Closes: https://lore.kernel.org/Z4467umXR2PZ0M1H@tucnak/
Reported-by: Kostadin Shishmanov <kostadinshishmanov@protonmail.com>
Reported-by: Jakub Jelinek <jakub@redhat.com>
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com>
Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
Cc:stable@vger.kernel.org
Link: https://lore.kernel.org/all/20250121-x86-use-std-consistently-gcc-15-v1-1-8ab0acf645cb%40kernel.org
[ Conflict in the context, because a few commits are not in this
version, e.g. commit 527afc212231 ("x86/boot: Check that there are no
run-time relocations") and commit 5fe392ff9d1f ("x86/boot/compressed:
Move CLANG_FLAGS to beginning of KBUILD_CFLAGS"). The same line can
still be added at the same place. ]
Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
---
arch/x86/boot/compressed/Makefile | 1 +
1 file changed, 1 insertion(+)
diff --git a/arch/x86/boot/compressed/Makefile b/arch/x86/boot/compressed/Makefile
index 62ef24bb2313..e436819859d9 100644
--- a/arch/x86/boot/compressed/Makefile
+++ b/arch/x86/boot/compressed/Makefile
@@ -27,6 +27,7 @@ targets := vmlinux vmlinux.bin vmlinux.bin.gz vmlinux.bin.bz2 vmlinux.bin.lzma \
vmlinux.bin.xz vmlinux.bin.lzo vmlinux.bin.lz4
KBUILD_CFLAGS := -m$(BITS) -O2
+KBUILD_CFLAGS += -std=gnu11
KBUILD_CFLAGS += -fno-strict-aliasing $(call cc-option, -fPIE, -fPIC)
KBUILD_CFLAGS += -DDISABLE_BRANCH_PROFILING
cflags-$(CONFIG_X86_32) := -march=i386
--
2.51.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 5.4.y 2/5] efi: libstub: Use '-std=gnu11' to fix build with GCC 15
2025-10-17 17:33 [PATCH 5.4.y 0/5] v5.4: fix build with GCC 15 Matthieu Baerts (NGI0)
2025-10-17 17:33 ` [PATCH 5.4.y 1/5] x86/boot: Use '-std=gnu11' to " Matthieu Baerts (NGI0)
@ 2025-10-17 17:33 ` Matthieu Baerts (NGI0)
2025-10-17 17:33 ` [PATCH 5.4.y 3/5] x86/boot: Compile boot code with -std=gnu11 too Matthieu Baerts (NGI0)
` (3 subsequent siblings)
5 siblings, 0 replies; 8+ messages in thread
From: Matthieu Baerts (NGI0) @ 2025-10-17 17:33 UTC (permalink / raw)
To: stable, Greg Kroah-Hartman, Sasha Levin
Cc: MPTCP Upstream, Matthieu Baerts (NGI0), Nathan Chancellor,
Kostadin Shishmanov, Jakub Jelinek, Ard Biesheuvel
From: Nathan Chancellor <nathan@kernel.org>
commit 8ba14d9f490aef9fd535c04e9e62e1169eb7a055 upstream.
GCC 15 changed the default C standard version to C23, which should not
have impacted the kernel because it requests the gnu11 standard via
'-std=' in the main Makefile. However, the EFI libstub Makefile uses its
own set of KBUILD_CFLAGS for x86 without a '-std=' value (i.e., using
the default), resulting in errors from the kernel's definitions of bool,
true, and false in stddef.h, which are reserved keywords under C23.
./include/linux/stddef.h:11:9: error: expected identifier before ‘false’
11 | false = 0,
./include/linux/types.h:35:33: error: two or more data types in declaration specifiers
35 | typedef _Bool bool;
Set '-std=gnu11' in the x86 cflags to resolve the error and consistently
use the same C standard version for the entire kernel. All other
architectures reuse KBUILD_CFLAGS from the rest of the kernel, so this
issue is not visible for them.
Cc: stable@vger.kernel.org
Reported-by: Kostadin Shishmanov <kostadinshishmanov@protonmail.com>
Closes: https://lore.kernel.org/4OAhbllK7x4QJGpZjkYjtBYNLd_2whHx9oFiuZcGwtVR4hIzvduultkgfAIRZI3vQpZylu7Gl929HaYFRGeMEalWCpeMzCIIhLxxRhq4U-Y=@protonmail.com/
Reported-by: Jakub Jelinek <jakub@redhat.com>
Closes: https://lore.kernel.org/Z4467umXR2PZ0M1H@tucnak/
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
[ Conflict in the context, because commit bbf8e8b0fe04 ("efi/libstub:
Optimize for size instead of speed") is not in this version.
'-std=gnu11' can still be added at the same place. ]
Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
---
drivers/firmware/efi/libstub/Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/firmware/efi/libstub/Makefile b/drivers/firmware/efi/libstub/Makefile
index 8c5b5529dbc0..0dc80564bbd2 100644
--- a/drivers/firmware/efi/libstub/Makefile
+++ b/drivers/firmware/efi/libstub/Makefile
@@ -7,7 +7,7 @@
#
cflags-$(CONFIG_X86_32) := -march=i386
cflags-$(CONFIG_X86_64) := -mcmodel=small
-cflags-$(CONFIG_X86) += -m$(BITS) -D__KERNEL__ -O2 \
+cflags-$(CONFIG_X86) += -m$(BITS) -D__KERNEL__ -O2 -std=gnu11 \
-fPIC -fno-strict-aliasing -mno-red-zone \
-mno-mmx -mno-sse -fshort-wchar \
-Wno-pointer-sign \
--
2.51.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 5.4.y 3/5] x86/boot: Compile boot code with -std=gnu11 too
2025-10-17 17:33 [PATCH 5.4.y 0/5] v5.4: fix build with GCC 15 Matthieu Baerts (NGI0)
2025-10-17 17:33 ` [PATCH 5.4.y 1/5] x86/boot: Use '-std=gnu11' to " Matthieu Baerts (NGI0)
2025-10-17 17:33 ` [PATCH 5.4.y 2/5] efi: libstub: " Matthieu Baerts (NGI0)
@ 2025-10-17 17:33 ` Matthieu Baerts (NGI0)
2025-10-17 17:33 ` [PATCH 5.4.y 4/5] arch: back to -std=gnu89 in < v5.18 Matthieu Baerts (NGI0)
` (2 subsequent siblings)
5 siblings, 0 replies; 8+ messages in thread
From: Matthieu Baerts (NGI0) @ 2025-10-17 17:33 UTC (permalink / raw)
To: stable, Greg Kroah-Hartman, Sasha Levin
Cc: MPTCP Upstream, Matthieu Baerts (NGI0), Alexey Dobriyan,
Ingo Molnar, H. Peter Anvin (Intel), Nathan Chancellor,
Dave Hansen, Ard Biesheuvel
From: Alexey Dobriyan <adobriyan@gmail.com>
commit b3bee1e7c3f2b1b77182302c7b2131c804175870 upstream.
Use -std=gnu11 for consistency with main kernel code.
It doesn't seem to change anything in vmlinux.
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Acked-by: H. Peter Anvin (Intel) <hpa@zytor.com>
Link: https://lore.kernel.org/r/2058761e-12a4-4b2f-9690-3c3c1c9902a5@p183
[ This kernel version doesn't build with GCC 15:
In file included from include/uapi/linux/posix_types.h:5,
from include/uapi/linux/types.h:14,
from include/linux/types.h:6,
from arch/x86/realmode/rm/wakeup.h:11,
from arch/x86/realmode/rm/wakemain.c:2:
include/linux/stddef.h:11:9: error: cannot use keyword 'false' as enumeration constant
11 | false = 0,
| ^~~~~
include/linux/stddef.h:11:9: note: 'false' is a keyword with '-std=c23' onwards
include/linux/types.h:30:33: error: 'bool' cannot be defined via 'typedef'
30 | typedef _Bool bool;
| ^~~~
include/linux/types.h:30:33: note: 'bool' is a keyword with '-std=c23' onwards
include/linux/types.h:30:1: warning: useless type name in empty declaration
30 | typedef _Bool bool;
| ^~~~~~~
The fix is similar to commit ee2ab467bddf ("x86/boot: Use '-std=gnu11'
to fix build with GCC 15") which has been backported to this kernel.
Note: In < 5.18 version, -std=gnu89 is used instead of -std=gnu11, see
commit e8c07082a810 ("Kbuild: move to -std=gnu11"). I suggest not to
modify that in this commit here as all the other similar fixes to
support GCC 15 set -std=gnu11. This can be done in a dedicated commit
if needed.
There was a conflict, because commit 2838307b019d ("x86/build: Remove
-m16 workaround for unsupported versions of GCC") and commit
accb8cfd506d ("x86/realmode: build with -D__DISABLE_EXPORTS") are not
in this version and change code in the context. -std=gnu11 can still
be added at the same place. ]
Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
---
Cc: Nathan Chancellor <nathan@kernel.org>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: Ard Biesheuvel <ardb@kernel.org>
---
arch/x86/Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/x86/Makefile b/arch/x86/Makefile
index 69f0cb01c666..69930ed5574b 100644
--- a/arch/x86/Makefile
+++ b/arch/x86/Makefile
@@ -31,7 +31,7 @@ endif
CODE16GCC_CFLAGS := -m32 -Wa,$(srctree)/arch/x86/boot/code16gcc.h
M16_CFLAGS := $(call cc-option, -m16, $(CODE16GCC_CFLAGS))
-REALMODE_CFLAGS := $(M16_CFLAGS) -g -Os -DDISABLE_BRANCH_PROFILING \
+REALMODE_CFLAGS := -std=gnu11 $(M16_CFLAGS) -g -Os -DDISABLE_BRANCH_PROFILING \
-Wall -Wstrict-prototypes -march=i386 -mregparm=3 \
-fno-strict-aliasing -fomit-frame-pointer -fno-pic \
-mno-mmx -mno-sse $(call cc-option,-fcf-protection=none)
--
2.51.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 5.4.y 4/5] arch: back to -std=gnu89 in < v5.18
2025-10-17 17:33 [PATCH 5.4.y 0/5] v5.4: fix build with GCC 15 Matthieu Baerts (NGI0)
` (2 preceding siblings ...)
2025-10-17 17:33 ` [PATCH 5.4.y 3/5] x86/boot: Compile boot code with -std=gnu11 too Matthieu Baerts (NGI0)
@ 2025-10-17 17:33 ` Matthieu Baerts (NGI0)
2025-10-17 17:33 ` [PATCH 5.4.y 5/5] kernel/profile.c: use cpumask_available to check for NULL cpumask Matthieu Baerts (NGI0)
2025-10-20 13:29 ` [PATCH 5.4.y 0/5] v5.4: fix build with GCC 15 Greg Kroah-Hartman
5 siblings, 0 replies; 8+ messages in thread
From: Matthieu Baerts (NGI0) @ 2025-10-17 17:33 UTC (permalink / raw)
To: stable, Greg Kroah-Hartman, Sasha Levin
Cc: MPTCP Upstream, Matthieu Baerts (NGI0), Nathan Chancellor,
Ard Biesheuvel, Alexey Dobriyan, Arnd Bergmann
Recent fixes have been backported to < v5.18 to fix build issues with
GCC 5.15. They all force -std=gnu11 in the CFLAGS, "because [the kernel]
requests the gnu11 standard via '-std=' in the main Makefile".
This is true for >= 5.18 versions, but not before. This switch to
-std=gnu11 has been done in commit e8c07082a810 ("Kbuild: move to
-std=gnu11").
For a question of uniformity, force -std=gnu89, similar to what is done
in the main Makefile.
Note: the fixes tags below refers to upstream commits, but this fix is
only for kernels not having commit e8c07082a810 ("Kbuild: move to
-std=gnu11").
Fixes: 7cbb015e2d3d ("parisc: fix building with gcc-15")
Fixes: 3b8b80e99376 ("s390: Add '-std=gnu11' to decompressor and purgatory CFLAGS")
Fixes: b3bee1e7c3f2 ("x86/boot: Compile boot code with -std=gnu11 too")
Fixes: ee2ab467bddf ("x86/boot: Use '-std=gnu11' to fix build with GCC 15")
Fixes: 8ba14d9f490a ("efi: libstub: Use '-std=gnu11' to fix build with GCC 15")
Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
---
Note:
An alternative is to backport commit e8c07082a810 ("Kbuild: move to
-std=gnu11"), but I guess we might not want to do that for stable, as
it might introduce new warnings.
Cc: Nathan Chancellor <nathan@kernel.org>
Cc: Ard Biesheuvel <ardb@kernel.org>
Cc: Alexey Dobriyan <adobriyan@gmail.com>
Cc: Arnd Bergmann <arnd@arndb.de>
---
arch/parisc/boot/compressed/Makefile | 2 +-
arch/s390/Makefile | 2 +-
arch/s390/purgatory/Makefile | 2 +-
arch/x86/Makefile | 2 +-
arch/x86/boot/compressed/Makefile | 2 +-
drivers/firmware/efi/libstub/Makefile | 2 +-
6 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/arch/parisc/boot/compressed/Makefile b/arch/parisc/boot/compressed/Makefile
index 98d69488e5c2..92cab904f1ba 100644
--- a/arch/parisc/boot/compressed/Makefile
+++ b/arch/parisc/boot/compressed/Makefile
@@ -21,7 +21,7 @@ KBUILD_CFLAGS += -fno-PIE -mno-space-regs -mdisable-fpregs -Os
ifndef CONFIG_64BIT
KBUILD_CFLAGS += -mfast-indirect-calls
endif
-KBUILD_CFLAGS += -std=gnu11
+KBUILD_CFLAGS += -std=gnu89
OBJECTS += $(obj)/head.o $(obj)/real2.o $(obj)/firmware.o $(obj)/misc.o $(obj)/piggy.o
diff --git a/arch/s390/Makefile b/arch/s390/Makefile
index 22dc393b5a83..287b853a7f09 100644
--- a/arch/s390/Makefile
+++ b/arch/s390/Makefile
@@ -23,7 +23,7 @@ endif
aflags_dwarf := -Wa,-gdwarf-2
KBUILD_AFLAGS_DECOMPRESSOR := $(CLANG_FLAGS) -m64 -D__ASSEMBLY__
KBUILD_AFLAGS_DECOMPRESSOR += $(if $(CONFIG_DEBUG_INFO),$(aflags_dwarf))
-KBUILD_CFLAGS_DECOMPRESSOR := $(CLANG_FLAGS) -m64 -O2 -std=gnu11
+KBUILD_CFLAGS_DECOMPRESSOR := $(CLANG_FLAGS) -m64 -O2 -std=gnu89
KBUILD_CFLAGS_DECOMPRESSOR += -DDISABLE_BRANCH_PROFILING -D__NO_FORTIFY
KBUILD_CFLAGS_DECOMPRESSOR += -fno-delete-null-pointer-checks -msoft-float
KBUILD_CFLAGS_DECOMPRESSOR += -fno-asynchronous-unwind-tables
diff --git a/arch/s390/purgatory/Makefile b/arch/s390/purgatory/Makefile
index 2f4d8422bdfb..facd0b3db637 100644
--- a/arch/s390/purgatory/Makefile
+++ b/arch/s390/purgatory/Makefile
@@ -20,7 +20,7 @@ GCOV_PROFILE := n
UBSAN_SANITIZE := n
KASAN_SANITIZE := n
-KBUILD_CFLAGS := -std=gnu11 -fno-strict-aliasing -Wall -Wstrict-prototypes
+KBUILD_CFLAGS := -std=gnu89 -fno-strict-aliasing -Wall -Wstrict-prototypes
KBUILD_CFLAGS += -Wno-pointer-sign -Wno-sign-compare
KBUILD_CFLAGS += -fno-zero-initialized-in-bss -fno-builtin -ffreestanding
KBUILD_CFLAGS += -c -MD -Os -m64 -msoft-float -fno-common
diff --git a/arch/x86/Makefile b/arch/x86/Makefile
index 69930ed5574b..424ee0e1f23d 100644
--- a/arch/x86/Makefile
+++ b/arch/x86/Makefile
@@ -31,7 +31,7 @@ endif
CODE16GCC_CFLAGS := -m32 -Wa,$(srctree)/arch/x86/boot/code16gcc.h
M16_CFLAGS := $(call cc-option, -m16, $(CODE16GCC_CFLAGS))
-REALMODE_CFLAGS := -std=gnu11 $(M16_CFLAGS) -g -Os -DDISABLE_BRANCH_PROFILING \
+REALMODE_CFLAGS := -std=gnu89 $(M16_CFLAGS) -g -Os -DDISABLE_BRANCH_PROFILING \
-Wall -Wstrict-prototypes -march=i386 -mregparm=3 \
-fno-strict-aliasing -fomit-frame-pointer -fno-pic \
-mno-mmx -mno-sse $(call cc-option,-fcf-protection=none)
diff --git a/arch/x86/boot/compressed/Makefile b/arch/x86/boot/compressed/Makefile
index e436819859d9..5771d5b43bb8 100644
--- a/arch/x86/boot/compressed/Makefile
+++ b/arch/x86/boot/compressed/Makefile
@@ -27,7 +27,7 @@ targets := vmlinux vmlinux.bin vmlinux.bin.gz vmlinux.bin.bz2 vmlinux.bin.lzma \
vmlinux.bin.xz vmlinux.bin.lzo vmlinux.bin.lz4
KBUILD_CFLAGS := -m$(BITS) -O2
-KBUILD_CFLAGS += -std=gnu11
+KBUILD_CFLAGS += -std=gnu89
KBUILD_CFLAGS += -fno-strict-aliasing $(call cc-option, -fPIE, -fPIC)
KBUILD_CFLAGS += -DDISABLE_BRANCH_PROFILING
cflags-$(CONFIG_X86_32) := -march=i386
diff --git a/drivers/firmware/efi/libstub/Makefile b/drivers/firmware/efi/libstub/Makefile
index 0dc80564bbd2..00622027a49f 100644
--- a/drivers/firmware/efi/libstub/Makefile
+++ b/drivers/firmware/efi/libstub/Makefile
@@ -7,7 +7,7 @@
#
cflags-$(CONFIG_X86_32) := -march=i386
cflags-$(CONFIG_X86_64) := -mcmodel=small
-cflags-$(CONFIG_X86) += -m$(BITS) -D__KERNEL__ -O2 -std=gnu11 \
+cflags-$(CONFIG_X86) += -m$(BITS) -D__KERNEL__ -O2 -std=gnu89 \
-fPIC -fno-strict-aliasing -mno-red-zone \
-mno-mmx -mno-sse -fshort-wchar \
-Wno-pointer-sign \
--
2.51.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 5.4.y 5/5] kernel/profile.c: use cpumask_available to check for NULL cpumask
2025-10-17 17:33 [PATCH 5.4.y 0/5] v5.4: fix build with GCC 15 Matthieu Baerts (NGI0)
` (3 preceding siblings ...)
2025-10-17 17:33 ` [PATCH 5.4.y 4/5] arch: back to -std=gnu89 in < v5.18 Matthieu Baerts (NGI0)
@ 2025-10-17 17:33 ` Matthieu Baerts (NGI0)
2025-10-20 13:29 ` [PATCH 5.4.y 0/5] v5.4: fix build with GCC 15 Greg Kroah-Hartman
5 siblings, 0 replies; 8+ messages in thread
From: Matthieu Baerts (NGI0) @ 2025-10-17 17:33 UTC (permalink / raw)
To: stable, Greg Kroah-Hartman, Sasha Levin
Cc: MPTCP Upstream, Matthieu Baerts (NGI0), Nathan Chancellor,
Andrew Morton, Thomas Gleixner, Linus Torvalds
From: Nathan Chancellor <natechancellor@gmail.com>
commit ef70eff9dea66f38f8c2c2dcc7fe4b7a2bbb4921 upstream.
When building with clang + -Wtautological-pointer-compare, these
instances pop up:
kernel/profile.c:339:6: warning: comparison of array 'prof_cpu_mask' not equal to a null pointer is always true [-Wtautological-pointer-compare]
if (prof_cpu_mask != NULL)
^~~~~~~~~~~~~ ~~~~
kernel/profile.c:376:6: warning: comparison of array 'prof_cpu_mask' not equal to a null pointer is always true [-Wtautological-pointer-compare]
if (prof_cpu_mask != NULL)
^~~~~~~~~~~~~ ~~~~
kernel/profile.c:406:26: warning: comparison of array 'prof_cpu_mask' not equal to a null pointer is always true [-Wtautological-pointer-compare]
if (!user_mode(regs) && prof_cpu_mask != NULL &&
^~~~~~~~~~~~~ ~~~~
3 warnings generated.
This can be addressed with the cpumask_available helper, introduced in
commit f7e30f01a9e2 ("cpumask: Add helper cpumask_available()") to fix
warnings like this while keeping the code the same.
Link: https://github.com/ClangBuiltLinux/linux/issues/747
Link: http://lkml.kernel.org/r/20191022191957.9554-1-natechancellor@gmail.com
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
Reviewed-by: Andrew Morton <akpm@linux-foundation.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
[ These warnings are also visible with recent GCC versions. ]
Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
---
kernel/profile.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/kernel/profile.c b/kernel/profile.c
index b5ce18b6f1b9..af3d5c34d051 100644
--- a/kernel/profile.c
+++ b/kernel/profile.c
@@ -344,7 +344,7 @@ static int profile_dead_cpu(unsigned int cpu)
struct page *page;
int i;
- if (prof_cpu_mask != NULL)
+ if (cpumask_available(prof_cpu_mask))
cpumask_clear_cpu(cpu, prof_cpu_mask);
for (i = 0; i < 2; i++) {
@@ -381,7 +381,7 @@ static int profile_prepare_cpu(unsigned int cpu)
static int profile_online_cpu(unsigned int cpu)
{
- if (prof_cpu_mask != NULL)
+ if (cpumask_available(prof_cpu_mask))
cpumask_set_cpu(cpu, prof_cpu_mask);
return 0;
@@ -411,7 +411,7 @@ void profile_tick(int type)
{
struct pt_regs *regs = get_irq_regs();
- if (!user_mode(regs) && prof_cpu_mask != NULL &&
+ if (!user_mode(regs) && cpumask_available(prof_cpu_mask) &&
cpumask_test_cpu(smp_processor_id(), prof_cpu_mask))
profile_hit(type, (void *)profile_pc(regs));
}
--
2.51.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 5.4.y 0/5] v5.4: fix build with GCC 15
2025-10-17 17:33 [PATCH 5.4.y 0/5] v5.4: fix build with GCC 15 Matthieu Baerts (NGI0)
` (4 preceding siblings ...)
2025-10-17 17:33 ` [PATCH 5.4.y 5/5] kernel/profile.c: use cpumask_available to check for NULL cpumask Matthieu Baerts (NGI0)
@ 2025-10-20 13:29 ` Greg Kroah-Hartman
2025-10-20 15:59 ` Matthieu Baerts
5 siblings, 1 reply; 8+ messages in thread
From: Greg Kroah-Hartman @ 2025-10-20 13:29 UTC (permalink / raw)
To: Matthieu Baerts (NGI0)
Cc: stable, Sasha Levin, MPTCP Upstream, Nathan Chancellor,
Kostadin Shishmanov, Jakub Jelinek, Dave Hansen, Ard Biesheuvel,
Alexey Dobriyan, Ingo Molnar, H. Peter Anvin (Intel),
Arnd Bergmann, Nathan Chancellor, Andrew Morton, Thomas Gleixner,
Linus Torvalds
On Fri, Oct 17, 2025 at 07:33:37PM +0200, Matthieu Baerts (NGI0) wrote:
> Two backports linked to build issues with GCC 15 have failed in this
> version:
>
> - ee2ab467bddf ("x86/boot: Use '-std=gnu11' to fix build with GCC 15")
> - 8ba14d9f490a ("efi: libstub: Use '-std=gnu11' to fix build with GCC 15")
>
> Conflicts have been solved, and described.
>
> After that, this kernel version still didn't build with GCC 15:
>
> In file included from include/uapi/linux/posix_types.h:5,
> from include/uapi/linux/types.h:14,
> from include/linux/types.h:6,
> from arch/x86/realmode/rm/wakeup.h:11,
> from arch/x86/realmode/rm/wakemain.c:2:
> include/linux/stddef.h:11:9: error: cannot use keyword 'false' as enumeration constant
> 11 | false = 0,
> | ^~~~~
> include/linux/stddef.h:11:9: note: 'false' is a keyword with '-std=c23' onwards
> include/linux/types.h:30:33: error: 'bool' cannot be defined via 'typedef'
> 30 | typedef _Bool bool;
> | ^~~~
> include/linux/types.h:30:33: note: 'bool' is a keyword with '-std=c23' onwards
> include/linux/types.h:30:1: warning: useless type name in empty declaration
> 30 | typedef _Bool bool;
> | ^~~~~~~
>
> I initially fixed this by adding -std=gnu11 in arch/x86/Makefile, then I
> realised this fix was already done in an upstream commit, created before
> the GCC 15 release and not mentioning the error I had. This is patch 3.
>
> When I was investigating my error, I noticed other commits were already
> backported to stable versions. They were all adding -std=gnu11 in
> different Makefiles. In their commit message, they were mentioning
> 'gnu11' was picked to use the same as the one from the main Makefile.
> But this is not the case in this kernel version. Patch 4 fixes that.
>
> Finally, I noticed extra warnings I didn't have in v5.10. Patch 5 fixes
> that.
5.4 is only going to be alive for about 1 more month, so I really don't
think trying to "downgrade" things here is worth it at all. Anyone
still stuck on this old, obsolete, and very insecure kernel tree isn't
going to be attempting to build it using the bleeding edge gcc release :)
So thanks for the patches, but i'll hold off on them for now.
thanks,
greg k-h
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 5.4.y 0/5] v5.4: fix build with GCC 15
2025-10-20 13:29 ` [PATCH 5.4.y 0/5] v5.4: fix build with GCC 15 Greg Kroah-Hartman
@ 2025-10-20 15:59 ` Matthieu Baerts
0 siblings, 0 replies; 8+ messages in thread
From: Matthieu Baerts @ 2025-10-20 15:59 UTC (permalink / raw)
To: Greg Kroah-Hartman
Cc: stable, Sasha Levin, MPTCP Upstream, Nathan Chancellor,
Kostadin Shishmanov, Jakub Jelinek, Dave Hansen, Ard Biesheuvel,
Alexey Dobriyan, Ingo Molnar, H. Peter Anvin (Intel),
Arnd Bergmann, Nathan Chancellor, Andrew Morton, Thomas Gleixner,
Linus Torvalds
Hi Greg,
Thank you for your reply!
On 20/10/2025 15:29, Greg Kroah-Hartman wrote:
> On Fri, Oct 17, 2025 at 07:33:37PM +0200, Matthieu Baerts (NGI0) wrote:
>> Two backports linked to build issues with GCC 15 have failed in this
>> version:
>>
>> - ee2ab467bddf ("x86/boot: Use '-std=gnu11' to fix build with GCC 15")
>> - 8ba14d9f490a ("efi: libstub: Use '-std=gnu11' to fix build with GCC 15")
>>
>> Conflicts have been solved, and described.
>>
>> After that, this kernel version still didn't build with GCC 15:
>>
>> In file included from include/uapi/linux/posix_types.h:5,
>> from include/uapi/linux/types.h:14,
>> from include/linux/types.h:6,
>> from arch/x86/realmode/rm/wakeup.h:11,
>> from arch/x86/realmode/rm/wakemain.c:2:
>> include/linux/stddef.h:11:9: error: cannot use keyword 'false' as enumeration constant
>> 11 | false = 0,
>> | ^~~~~
>> include/linux/stddef.h:11:9: note: 'false' is a keyword with '-std=c23' onwards
>> include/linux/types.h:30:33: error: 'bool' cannot be defined via 'typedef'
>> 30 | typedef _Bool bool;
>> | ^~~~
>> include/linux/types.h:30:33: note: 'bool' is a keyword with '-std=c23' onwards
>> include/linux/types.h:30:1: warning: useless type name in empty declaration
>> 30 | typedef _Bool bool;
>> | ^~~~~~~
>>
>> I initially fixed this by adding -std=gnu11 in arch/x86/Makefile, then I
>> realised this fix was already done in an upstream commit, created before
>> the GCC 15 release and not mentioning the error I had. This is patch 3.
>>
>> When I was investigating my error, I noticed other commits were already
>> backported to stable versions. They were all adding -std=gnu11 in
>> different Makefiles. In their commit message, they were mentioning
>> 'gnu11' was picked to use the same as the one from the main Makefile.
>> But this is not the case in this kernel version. Patch 4 fixes that.
>>
>> Finally, I noticed extra warnings I didn't have in v5.10. Patch 5 fixes
>> that.
>
> 5.4 is only going to be alive for about 1 more month, so I really don't
> think trying to "downgrade" things here is worth it at all. Anyone
> still stuck on this old, obsolete, and very insecure kernel tree isn't
> going to be attempting to build it using the bleeding edge gcc release :)
Fine by me for v5.4. I only suggested these very small patches because I
had issues with GCC 15 when building v5.15, and I did the small work for
older kernels.
Please note that the two last patches are not directly linked to GCC 15:
- Patch 4/5 fixes the possible bump to C11 standard for some arch. So if
I'm not mistaken, it changes the minimal requirements from GCC 4.6 to
GCC 4.9. Is it not an issue for such old kernel?
(Note: this patch depends on the parents ones, but can be adapted)
- Patch 5/5 fixes a warning I saw, but I don't know from which version
GCC complains about that.
Cheers,
Matt
--
Sponsored by the NGI0 Core fund.
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2025-10-20 15:59 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-17 17:33 [PATCH 5.4.y 0/5] v5.4: fix build with GCC 15 Matthieu Baerts (NGI0)
2025-10-17 17:33 ` [PATCH 5.4.y 1/5] x86/boot: Use '-std=gnu11' to " Matthieu Baerts (NGI0)
2025-10-17 17:33 ` [PATCH 5.4.y 2/5] efi: libstub: " Matthieu Baerts (NGI0)
2025-10-17 17:33 ` [PATCH 5.4.y 3/5] x86/boot: Compile boot code with -std=gnu11 too Matthieu Baerts (NGI0)
2025-10-17 17:33 ` [PATCH 5.4.y 4/5] arch: back to -std=gnu89 in < v5.18 Matthieu Baerts (NGI0)
2025-10-17 17:33 ` [PATCH 5.4.y 5/5] kernel/profile.c: use cpumask_available to check for NULL cpumask Matthieu Baerts (NGI0)
2025-10-20 13:29 ` [PATCH 5.4.y 0/5] v5.4: fix build with GCC 15 Greg Kroah-Hartman
2025-10-20 15:59 ` Matthieu Baerts
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox