commit: 016ecfd60453c0c87fdd9680869b7d303046a948 Author: Mike Pagano <mpagano <AT> gentoo <DOT> org> AuthorDate: Sat May 3 19:44:15 2025 +0000 Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org> CommitDate: Sat May 3 19:44:15 2025 +0000 URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=016ecfd6
GCC 15 defaults to -std=gnu23. Hack in CSTD_FLAG to pass -std=gnu11 everywhere Bug: 954704 Signed-off-by: Mike Pagano <mpagano <AT> gentoo.org> 0000_README | 4 ++ 2980_GCC15-gnu23-to-gnu11-fix.patch | 105 ++++++++++++++++++++++++++++++++++++ 2 files changed, 109 insertions(+) diff --git a/0000_README b/0000_README index 8bf06171..9ad7a45d 100644 --- a/0000_README +++ b/0000_README @@ -455,6 +455,10 @@ Patch: 2952_resolve-btfids-Fix-compiler-warnings.patch From: https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git/commit/?id=2c3d022abe6c3165109393b75a127b06c2c70063 Desc: resolve_btfids: Fix compiler warnings +Patch: 2980_GCC15-gnu23-to-gnu11-fix.patch +From: https://lore.kernel.org/linux-kbuild/20241119044724.GA2246422@thelio-3990X/ +Desc: GCC 15 defaults to -std=gnu23. Hack in CSTD_FLAG to pass -std=gnu11 everywhere. + Patch: 2990_libbpf-v2-workaround-Wmaybe-uninitialized-false-pos.patch From: https://lore.kernel.org/bpf/3ebbe7a4e93a5ddc3a26e2e11d329801d7c8de6b.1723217044.git....@gentoo.org/ Desc: libbpf: workaround -Wmaybe-uninitialized false positive diff --git a/2980_GCC15-gnu23-to-gnu11-fix.patch b/2980_GCC15-gnu23-to-gnu11-fix.patch new file mode 100644 index 00000000..cf95d07c --- /dev/null +++ b/2980_GCC15-gnu23-to-gnu11-fix.patch @@ -0,0 +1,105 @@ +GCC 15 defaults to -std=gnu23. While most of the kernel builds with -std=gnu11, +some of it forgets to pass that flag. Hack in CSTD_FLAG to pass -std=gnu11 +everywhere. + +https://lore.kernel.org/linux-kbuild/20241119044724.GA2246422@thelio-3990X/ +--- a/Makefile 2025-05-03 15:20:32.416275719 -0400 ++++ b/Makefile 2025-05-03 15:31:25.208482201 -0400 +@@ -428,6 +428,8 @@ export KCONFIG_CONFIG + # SHELL used by kbuild + CONFIG_SHELL := sh + ++CSTD_FLAG := -std=gnu11 ++ + HOST_LFS_CFLAGS := $(shell getconf LFS_CFLAGS 2>/dev/null) + HOST_LFS_LDFLAGS := $(shell getconf LFS_LDFLAGS 2>/dev/null) + HOST_LFS_LIBS := $(shell getconf LFS_LIBS 2>/dev/null) +@@ -449,7 +451,7 @@ HOSTRUSTC = rustc + HOSTPKG_CONFIG = pkg-config + + KBUILD_USERHOSTCFLAGS := -Wall -Wmissing-prototypes -Wstrict-prototypes \ +- -O2 -fomit-frame-pointer -std=gnu11 ++ -O2 -fomit-frame-pointer $(CSTD_FLAG) + KBUILD_USERCFLAGS := $(KBUILD_USERHOSTCFLAGS) $(USERCFLAGS) + KBUILD_USERLDFLAGS := $(USERLDFLAGS) + +@@ -557,7 +559,7 @@ LINUXINCLUDE := \ + KBUILD_AFLAGS := -D__ASSEMBLY__ -fno-PIE + + KBUILD_CFLAGS := +-KBUILD_CFLAGS += -std=gnu11 ++KBUILD_CFLAGS += $(CSTD_FLAG) + KBUILD_CFLAGS += -fshort-wchar + KBUILD_CFLAGS += -funsigned-char + KBUILD_CFLAGS += -fno-common +@@ -606,7 +608,7 @@ export CPP AR NM STRIP OBJCOPY OBJDUMP R + export PERL PYTHON3 CHECK CHECKFLAGS MAKE UTS_MACHINE HOSTCXX + export KGZIP KBZIP2 KLZOP LZMA LZ4 XZ ZSTD + export KBUILD_HOSTCXXFLAGS KBUILD_HOSTLDFLAGS KBUILD_HOSTLDLIBS LDFLAGS_MODULE +-export KBUILD_USERCFLAGS KBUILD_USERLDFLAGS ++export KBUILD_USERCFLAGS KBUILD_USERLDFLAGS CSTD_FLAG + + export KBUILD_CPPFLAGS NOSTDINC_FLAGS LINUXINCLUDE OBJCOPYFLAGS KBUILD_LDFLAGS + export KBUILD_CFLAGS CFLAGS_KERNEL CFLAGS_MODULE +--- a/arch/arm64/kernel/vdso32/Makefile 2025-05-03 15:21:13.032492816 -0400 ++++ b/arch/arm64/kernel/vdso32/Makefile 2025-05-03 15:32:32.502298323 -0400 +@@ -65,7 +65,7 @@ VDSO_CFLAGS += -Wall -Wundef -Wstrict-pr + -fno-strict-aliasing -fno-common \ + -Werror-implicit-function-declaration \ + -Wno-format-security \ +- -std=gnu11 ++ $(CSTD_FLAG) + VDSO_CFLAGS += -O2 + # Some useful compiler-dependent flags from top-level Makefile + VDSO_CFLAGS += $(call cc32-option,-Wno-pointer-sign) +--- a/arch/x86/Makefile 2025-05-03 15:21:48.644723563 -0400 ++++ b/arch/x86/Makefile 2025-05-03 15:33:07.495502552 -0400 +@@ -43,7 +43,7 @@ endif + + # How to compile the 16-bit code. Note we always compile for -march=i386; + # that way we can complain to the user if the CPU is insufficient. +-REALMODE_CFLAGS := -m16 -g -Os -DDISABLE_BRANCH_PROFILING -D__DISABLE_EXPORTS \ ++REALMODE_CFLAGS := $(CSTD_FLAG) -m16 -g -Os -DDISABLE_BRANCH_PROFILING -D__DISABLE_EXPORTS \ + -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) +--- a/drivers/firmware/efi/libstub/Makefile 2025-05-03 15:22:44.523804022 -0400 ++++ b/drivers/firmware/efi/libstub/Makefile 2025-05-03 15:34:35.211231426 -0400 +@@ -7,7 +7,7 @@ + # + + # non-x86 reuses KBUILD_CFLAGS, x86 does not +-cflags-y := $(KBUILD_CFLAGS) ++cflags-y := $(KBUILD_CFLAGS) $(CSTD_FLAG) + + cflags-$(CONFIG_X86_32) := -march=i386 + cflags-$(CONFIG_X86_64) := -mcmodel=small +@@ -18,7 +18,7 @@ cflags-$(CONFIG_X86) += -m$(BITS) -D__K + $(call cc-disable-warning, address-of-packed-member) \ + $(call cc-disable-warning, gnu) \ + -fno-asynchronous-unwind-tables \ +- $(CLANG_FLAGS) ++ $(CLANG_FLAGS) $(CSTD_FLAG) + + # arm64 uses the full KBUILD_CFLAGS so it's necessary to explicitly + # disable the stackleak plugin +@@ -40,7 +40,7 @@ KBUILD_CFLAGS := $(subst $(CC_FLAGS_FT + -ffreestanding \ + -fno-stack-protector \ + $(call cc-option,-fno-addrsig) \ +- -D__DISABLE_EXPORTS ++ -D__DISABLE_EXPORTS $(CSTD_FLAG) + + # + # struct randomization only makes sense for Linux internal types, which the EFI +--- a/arch/x86/boot/compressed/Makefile 2025-05-03 15:23:42.863989230 -0400 ++++ b/arch/x86/boot/compressed/Makefile 2025-05-03 15:35:41.268113485 -0400 +@@ -33,7 +33,7 @@ targets := vmlinux vmlinux.bin vmlinux.b + # case of cross compiling, as it has the '--target=' flag, which is needed to + # avoid errors with '-march=i386', and future flags may depend on the target to + # be valid. +-KBUILD_CFLAGS := -m$(BITS) -O2 $(CLANG_FLAGS) ++KBUILD_CFLAGS := -m$(BITS) -O2 $(CLANG_FLAGS) $(CSTD_FLAG) + KBUILD_CFLAGS += -std=gnu11 + KBUILD_CFLAGS += -fno-strict-aliasing -fPIE + KBUILD_CFLAGS += -Wundef
