[lkml]   [2023]   [Jan]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Patch in this message
Subject[PATCH 2/2] kbuild: do not export LDFLAGS_vmlinux to decompressor Makefiles
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

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

Fixes: 5d4aeffbf709 ("kbuild: rebuild .vmlinux.export.o when its prerequisite is updated")
Signed-off-by: Masahiro Yamada <>

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 =
-export LDFLAGS_vmlinux =
+LDFLAGS_vmlinux =

# Use USERINCLUDE when you must reference the UAPI directories only.
@@ -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

 \ /
  Last update: 2023-03-26 23:31    [W:0.061 / U:0.164 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site