Skip to content

Commit 1c9e041

Browse files
committed
Add a patch to fix building under GCC 15
GCC 15 defaults to gnu23, breaking some parts of the kernel which doesn't receive the "-std=gnu11" flag. Add a patch to explicitly pass that flag to arch/x86/boot/compressed until upstream makes up their mind on how to fix this. Signed-off-by: Sergio Lopez <[email protected]>
1 parent 03fe3f1 commit 1c9e041

File tree

2 files changed

+46
-2
lines changed

2 files changed

+46
-2
lines changed

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ KERNEL_PATCHES = $(shell find patches/ -name "0*.patch" | sort)
66
KERNEL_C_BUNDLE = kernel.c
77

88
ABI_VERSION = 4
9-
FULL_VERSION = 4.7.0
10-
TIMESTAMP = "Wed Dec 11 20:34:13 CET 2024"
9+
FULL_VERSION = 4.7.1
10+
TIMESTAMP = "Mon Jan 20 16:45:32 CET 2025"
1111

1212
KERNEL_FLAGS = KBUILD_BUILD_TIMESTAMP=$(TIMESTAMP)
1313
KERNEL_FLAGS += KBUILD_BUILD_USER=root
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
From ed8a28bfd78e90ae9fe27b6eafe1affd93a80f71 Mon Sep 17 00:00:00 2001
2+
From: Sergio Lopez <[email protected]>
3+
Date: Mon, 20 Jan 2025 16:38:26 +0100
4+
Subject: [PATCH 23/27] arch/x86,efi/libstub: use -std=gnu11 flag
5+
6+
GCC 15 defaults to gnu23, but the kernel is not compatible to that
7+
standard. Other parts of the kernel use -std=gnu11, so let's do the same
8+
in arch/x86/boot/compressed and efi/libstub.
9+
10+
Signed-off-by: Sergio Lopez <[email protected]>
11+
---
12+
arch/x86/boot/compressed/Makefile | 2 +-
13+
drivers/firmware/efi/libstub/Makefile | 2 +-
14+
2 files changed, 2 insertions(+), 2 deletions(-)
15+
16+
diff --git a/arch/x86/boot/compressed/Makefile b/arch/x86/boot/compressed/Makefile
17+
index f2051644de94..5c8b86dfb1ea 100644
18+
--- a/arch/x86/boot/compressed/Makefile
19+
+++ b/arch/x86/boot/compressed/Makefile
20+
@@ -24,7 +24,7 @@ targets := vmlinux vmlinux.bin vmlinux.bin.gz vmlinux.bin.bz2 vmlinux.bin.lzma \
21+
# case of cross compiling, as it has the '--target=' flag, which is needed to
22+
# avoid errors with '-march=i386', and future flags may depend on the target to
23+
# be valid.
24+
-KBUILD_CFLAGS := -m$(BITS) -O2 $(CLANG_FLAGS)
25+
+KBUILD_CFLAGS := -std=gnu11 -m$(BITS) -O2 $(CLANG_FLAGS)
26+
KBUILD_CFLAGS += -fno-strict-aliasing -fPIE
27+
KBUILD_CFLAGS += -Wundef
28+
KBUILD_CFLAGS += -DDISABLE_BRANCH_PROFILING
29+
diff --git a/drivers/firmware/efi/libstub/Makefile b/drivers/firmware/efi/libstub/Makefile
30+
index ed4e8ddbe76a..78cdf380ffcc 100644
31+
--- a/drivers/firmware/efi/libstub/Makefile
32+
+++ b/drivers/firmware/efi/libstub/Makefile
33+
@@ -36,7 +36,7 @@ cflags-$(CONFIG_LOONGARCH) += -fpie
34+
cflags-$(CONFIG_EFI_PARAMS_FROM_FDT) += -I$(srctree)/scripts/dtc/libfdt
35+
36+
KBUILD_CFLAGS := $(subst $(CC_FLAGS_FTRACE),,$(cflags-y)) \
37+
- -Os -DDISABLE_BRANCH_PROFILING \
38+
+ -std=gnu11 -Os -DDISABLE_BRANCH_PROFILING \
39+
-include $(srctree)/include/linux/hidden.h \
40+
-D__NO_FORTIFY \
41+
-ffreestanding \
42+
--
43+
2.45.2
44+

0 commit comments

Comments
 (0)