Commit 3ec8a5b33dea ("kbuild: do not export LDFLAGS_vmlinux") unexported LDFLAGS_vmlinux because LDFLAGS_vmlinux in the top Makefile and the one in arch/*/boot/compressed/Makefile are unrelated to each other. It is just the decompressors, arch/*/boot/compressed/vmlinux just happen to have the same base name. Commit 5d4aeffbf709 ("kbuild: rebuild .vmlinux.export.o when its prerequisite is updated") accidentally exported it again. The issue reported so far is $(NM) error message when building the ARM decompressor with GNU Make >= 4.4. This was fixed by refactoring arch/arm/boot/compressed/Makefile. The error message fixed by 3ec8a5b33dea is very likely to happen in the current cleaning code, but it would still be possible on systems with a huge number of CPUs. Anyway, LDFLAGS_vmlinux should not be exported to the decompressor Makefiles. Fixes: 5d4aeffbf709 ("kbuild: rebuild .vmlinux.export.o when its prerequisite is updated") Signed-off-by: Masahiro Yamada <masahiroy@xxxxxxxxxx> --- Makefile | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index dfba294ae790..146cdf195e56 100644 --- a/Makefile +++ b/Makefile @@ -549,7 +549,7 @@ LDFLAGS_MODULE = CFLAGS_KERNEL = RUSTFLAGS_KERNEL = AFLAGS_KERNEL = -export LDFLAGS_vmlinux = +LDFLAGS_vmlinux = # Use USERINCLUDE when you must reference the UAPI directories only. USERINCLUDE := \ @@ -1248,6 +1248,11 @@ vmlinux.o modules.builtin.modinfo modules.builtin: vmlinux_o @: PHONY += vmlinux +# LDFLAGS_vmlinux flags from the top Makefile and arch/*/Makefile should be +# exported for building the top vmlinux, but not for building decompressors. +# They have the same base name (arch/*/boot/compressed/vmlinux), but the +# decompressor Makefiles should not inherit LDFLAGS_vmlinux. +vmlinux: export LDFLAGS_vmlinux := $(LDFLAGS_vmlinux) vmlinux: vmlinux.o $(KBUILD_LDS) modpost $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.vmlinux -- 2.34.1