diff mbox series

[2/2] kbuild: do not export LDFLAGS_vmlinux to decompressor Makefiles

Message ID 20230107212019.2575770-2-masahiroy@kernel.org (mailing list archive)
State New, archived
Headers show
Series [1/2] ARM: fix nm error message when GNU Make >= 4.4 is used | expand

Commit Message

Masahiro Yamada Jan. 7, 2023, 9:20 p.m. UTC
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@kernel.org>
---

 Makefile | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
diff mbox series

Patch

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