[PATCH RFC 4/9] arch: boot: put the LZ4 freestanding headers on the decompressor path
WARM1d
From: Michal Wilczynski <m.wilczynski@samsung.com>
Date: 2026-09-25 11:35:00
Also in:
linux-block, linux-crypto, linux-f2fs-devel, linux-mips, linux-s390, lkml, llvm
Subsystem:
arm port, mips, parisc architecture, s390 architecture, the rest, x86 architecture (32-bit and 64-bit) · Maintainers:
Russell King, Thomas Bogendoerfer, "James E.J. Bottomley", Helge Deller, Heiko Carstens, Vasily Gorbik, Alexander Gordeev, Linus Torvalds, Thomas Gleixner, Ingo Molnar, Borislav Petkov, Dave Hansen
lib/decompress_unlz4.c pulls lib/lz4/lz4_decompress.c into the pre-boot decompressor on these five arches. A later patch makes that file include the vendored LZ4 sources, which include ISO C headers that -nostdinc does not provide, so put lib/lz4/freestanding on the include path first. Signed-off-by: Michal Wilczynski <m.wilczynski@samsung.com> --- arch/arm/boot/compressed/Makefile | 3 +++ arch/mips/boot/compressed/Makefile | 4 ++++ arch/parisc/boot/compressed/Makefile | 3 +++ arch/s390/boot/Makefile | 3 +++ arch/x86/boot/compressed/Makefile | 3 +++ 5 files changed, 16 insertions(+)
diff --git a/arch/arm/boot/compressed/Makefile b/arch/arm/boot/compressed/Makefile
index e3f550d6285786c8405b16768255af87b4dc8222..c0418ef2618bbcbf18f905e619031c37661563ed 100644
--- a/arch/arm/boot/compressed/Makefile
+++ b/arch/arm/boot/compressed/Makefile@@ -92,6 +92,9 @@ targets := vmlinux vmlinux.lds piggy_data piggy.o \ head.o $(OBJS) KBUILD_CFLAGS += -DDISABLE_BRANCH_PROFILING +# decompress_unlz4.c builds the vendored LZ4 sources, which include a few +# ISO C headers -nostdinc drops. +KBUILD_CFLAGS += -I$(srctree)/lib/lz4/freestanding ccflags-y := -fpic $(call cc-option,-mno-single-pic-base,) -fno-builtin \ -I$(srctree)/scripts/dtc/libfdt -fno-stack-protector \
diff --git a/arch/mips/boot/compressed/Makefile b/arch/mips/boot/compressed/Makefile
index e0b8ec9a9516281933b6cc5b175e82f4013c2f54..b832b8a26f20073d817fb50bc4c8015de006b5e4 100644
--- a/arch/mips/boot/compressed/Makefile
+++ b/arch/mips/boot/compressed/Makefile@@ -30,6 +30,10 @@ endif KBUILD_CFLAGS := $(KBUILD_CFLAGS) -D__KERNEL__ -D__DISABLE_EXPORTS \ -DBOOT_HEAP_SIZE=$(BOOT_HEAP_SIZE) -D"VMLINUX_LOAD_ADDRESS_ULL=$(VMLINUX_LOAD_ADDRESS)ull" +# decompress_unlz4.c builds the vendored LZ4 sources, which include a few +# ISO C headers -nostdinc drops. +KBUILD_CFLAGS += -I$(srctree)/lib/lz4/freestanding + KBUILD_AFLAGS := $(KBUILD_AFLAGS) -D__ASSEMBLY__ \ -DBOOT_HEAP_SIZE=$(BOOT_HEAP_SIZE) \ -DKERNEL_ENTRY=$(VMLINUX_ENTRY_ADDRESS)
diff --git a/arch/parisc/boot/compressed/Makefile b/arch/parisc/boot/compressed/Makefile
index 14eefb5ed5d1d781a4ee0cb2ef61ab86c905cc56..1d4a3e66e3503714c1f723dedb15598183ec8b0a 100644
--- a/arch/parisc/boot/compressed/Makefile
+++ b/arch/parisc/boot/compressed/Makefile@@ -12,6 +12,9 @@ targets += $(OBJECTS) sizes.h KBUILD_CFLAGS := -D__KERNEL__ -O2 -DBOOTLOADER KBUILD_CFLAGS += -DDISABLE_BRANCH_PROFILING +# decompress_unlz4.c builds the vendored LZ4 sources, which include a few +# ISO C headers -nostdinc drops. +KBUILD_CFLAGS += -I$(srctree)/lib/lz4/freestanding KBUILD_CFLAGS += -fno-strict-aliasing KBUILD_CFLAGS += $(cflags-y) -fno-delete-null-pointer-checks -fno-builtin-printf KBUILD_CFLAGS += -fno-PIE -mno-space-regs -mdisable-fpregs -Os
diff --git a/arch/s390/boot/Makefile b/arch/s390/boot/Makefile
index 10b75e053a6f6bb9083548e8f82796f0aa9a9958..fd88523eb1102af1eb1f821e156b8faadb502879 100644
--- a/arch/s390/boot/Makefile
+++ b/arch/s390/boot/Makefile@@ -21,6 +21,9 @@ KBUILD_AFLAGS := $(filter-out $(CC_FLAGS_MARCH),$(KBUILD_AFLAGS_DECOMPRESSOR)) KBUILD_CFLAGS := $(filter-out $(CC_FLAGS_MARCH),$(KBUILD_CFLAGS_DECOMPRESSOR)) KBUILD_AFLAGS += $(CC_FLAGS_MARCH_MINIMUM) -D__DISABLE_EXPORTS KBUILD_CFLAGS += $(CC_FLAGS_MARCH_MINIMUM) -D__DISABLE_EXPORTS +# decompress_unlz4.c builds the vendored LZ4 sources, which include a few +# ISO C headers -nostdinc drops. +KBUILD_CFLAGS += -I$(srctree)/lib/lz4/freestanding KBUILD_CFLAGS += $(call cc-option, -Wno-default-const-init-unsafe) CFLAGS_sclp_early_core.o += -I$(srctree)/drivers/s390/char
diff --git a/arch/x86/boot/compressed/Makefile b/arch/x86/boot/compressed/Makefile
index 06934f9691d6a9d6952532ae5f7d96f5858719dd..d200a0a4c28b9e7be1be45f603e625eb573d0220 100644
--- a/arch/x86/boot/compressed/Makefile
+++ b/arch/x86/boot/compressed/Makefile@@ -30,6 +30,9 @@ KBUILD_CFLAGS += -fno-strict-aliasing -fPIE KBUILD_CFLAGS += -fno-jump-tables KBUILD_CFLAGS += -Wundef KBUILD_CFLAGS += -DDISABLE_BRANCH_PROFILING +# decompress_unlz4.c builds the vendored LZ4 sources, which include a few +# ISO C headers -nostdinc drops. +KBUILD_CFLAGS += -I$(srctree)/lib/lz4/freestanding cflags-$(CONFIG_X86_32) := -march=i386 cflags-$(CONFIG_X86_64) := -mcmodel=small -mno-red-zone KBUILD_CFLAGS += $(cflags-y)
--
2.34.1