mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] kbuild: serialize scripts after scripts_unifdef
@ 2026-12-03 19:18 HONG Yifan
  0 siblings, 0 replies; only message in thread
From: HONG Yifan @ 2026-12-03 19:18 UTC (permalink / raw)
  To: Nathan Chancellor, Nicolas Schier
  Cc: Masahiro Yamada, linux-kbuild, linux-kernel, kernel-team,
	HONG Yifan, stable

When CONFIG_HEADERS_INSTALL is enabled, the prepare target depends on
both prepare0 -> archprepare -> scripts and headers -> scripts_unifdef
with no ordering between scripts and scripts_unifdef. Both targets
invoke $(MAKE) $(build)=scripts concurrently:

  scripts:         $(MAKE) $(build)=scripts
  scripts_unifdef: $(MAKE) $(build)=scripts scripts/unifdef

Because scripts/Makefile lists unifdef in hostprogs,
scripts/Makefile.host adds scripts/unifdef to targets, causing
scripts/Makefile.build to include scripts/.unifdef.cmd as soon as
scripts/unifdef exists. If scripts reads scripts/.unifdef.cmd while
scripts_unifdef is still writing it via fixdep, make aborts with:

  scripts/.unifdef.cmd:1: *** missing separator.  Stop.
  make[2]: *** [Makefile:1400: scripts] Error 2

Make scripts depend on scripts_unifdef under CONFIG_HEADERS_INSTALL so
scripts_unifdef finishes before scripts enters scripts/. Keeping the
dependency under CONFIG_HEADERS_INSTALL avoids building scripts/unifdef
when it is not needed and preserves "make headers" without a .config.

Bug triage, instrumented reproduction, and patch drafting were assisted
by Gemini.

Fixes: e949f4c2d6a3 ("kbuild: add CONFIG_HEADERS_INSTALL and loosen the dependency of samples")
Cc: stable@vger.kernel.org
Signed-off-by: HONG Yifan <elsk@google.com>
---
 Makefile | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Makefile b/Makefile
index 5aac6f1b011e..787e041b5d7e 100644
--- a/Makefile
+++ b/Makefile
@@ -1518,6 +1518,7 @@ endif
 
 ifdef CONFIG_HEADERS_INSTALL
 prepare: headers
+scripts: scripts_unifdef
 endif
 
 PHONY += scripts_gen_init_cpio

base-commit: 63fdb511c27afcebce797e3db580b3534ddfa639
-- 
2.56.1.915.g69d5ec7298-goog


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-12-03 19:18 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-12-03 19:18 [PATCH] kbuild: serialize scripts after scripts_unifdef HONG Yifan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®