* [PATCH] kbuild: avoid recursive make headers when HEADER_ARCH is set
@ 2026-12-04 23:21 HONG Yifan
2026-12-05 12:04 ` Thomas Weißschuh
0 siblings, 1 reply; 2+ messages in thread
From: HONG Yifan @ 2026-12-04 23:21 UTC (permalink / raw)
To: Nathan Chancellor, Nicolas Schier
Cc: Thomas Weißschuh, Masahiro Yamada, Richard Weinberger,
Anton Ivanov, Johannes Berg, linux-kbuild, linux-um, linux-kernel,
stable, HONG Yifan
When HEADER_ARCH is set (ARCH=um), the headers target spawns a recursive
$(MAKE) -f $(srctree)/Makefile HEADER_ARCH= SRCARCH=$(HEADER_ARCH) headers.
This re-runs $(version_h), scripts_unifdef, uapi-asm-generic, and
archheaders a second time.
Because headers is in no-dot-config-targets, the recursive sub-make skips
include/config/auto.conf and drops CONFIG_WERROR flags (-Werror and
-Wl,--fatal-warnings) from KBUILD_HOSTCFLAGS and KBUILD_HOSTLDFLAGS,
causing scripts/unifdef to be recompiled on every prepare build with
CONFIG_HEADERS_INSTALL=y and CONFIG_WERROR=y. During parallel builds, the
recursive $(build)=scripts scripts/unifdef also races with the scripts
target even when scripts depends on the outer scripts_unifdef.
arch/um/Makefile's archheaders target already invokes
ARCH=$(HEADER_ARCH) asm-generic archheaders, generating the required
arch/$(HEADER_ARCH)/include/generated/uapi/ headers. Invoke $(hdr-inst)
directly for include/uapi (passing SRCARCH for include/uapi/Kbuild) and
arch/$(or $(HEADER_ARCH),$(SRCARCH))/include/uapi instead of recursing
into top-level headers.
Investigation, verification, and patch drafting were assisted by Gemini.
Fixes: 268d191abc57 ("kbuild: implement CONFIG_HEADERS_INSTALL for Usermode Linux")
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/CAABy=s2iGODbNUdjYFd3MHLsTWsoN3_L5=v4aTX_wW4C3n1_Rg@mail.gmail.com
Signed-off-by: HONG Yifan <elsk@google.com>
---
Makefile | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/Makefile b/Makefile
index 5aac6f1b011e..d990a19e7839 100644
--- a/Makefile
+++ b/Makefile
@@ -1509,12 +1509,8 @@ hdr-inst := -f $(srctree)/scripts/Makefile.headersinst obj
PHONY += headers
headers: $(version_h) scripts_unifdef uapi-asm-generic archheaders
-ifdef HEADER_ARCH
- $(Q)$(MAKE) -f $(srctree)/Makefile HEADER_ARCH= SRCARCH=$(HEADER_ARCH) headers
-else
- $(Q)$(MAKE) $(hdr-inst)=include/uapi
- $(Q)$(MAKE) $(hdr-inst)=arch/$(SRCARCH)/include/uapi
-endif
+ $(Q)$(MAKE) $(hdr-inst)=include/uapi SRCARCH=$(or $(HEADER_ARCH),$(SRCARCH))
+ $(Q)$(MAKE) $(hdr-inst)=arch/$(or $(HEADER_ARCH),$(SRCARCH))/include/uapi
ifdef CONFIG_HEADERS_INSTALL
prepare: headers
base-commit: 63fdb511c27afcebce797e3db580b3534ddfa639
--
2.56.1.915.g69d5ec7298-goog
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] kbuild: avoid recursive make headers when HEADER_ARCH is set
2026-12-04 23:21 [PATCH] kbuild: avoid recursive make headers when HEADER_ARCH is set HONG Yifan
@ 2026-12-05 12:04 ` Thomas Weißschuh
0 siblings, 0 replies; 2+ messages in thread
From: Thomas Weißschuh @ 2026-12-05 12:04 UTC (permalink / raw)
To: HONG Yifan
Cc: Nathan Chancellor, Nicolas Schier, Thomas Weißschuh,
Masahiro Yamada, Richard Weinberger, Anton Ivanov, Johannes Berg,
linux-kbuild, linux-um, linux-kernel, stable
On 2026-12-04 23:21:02+0000, HONG Yifan wrote:
> When HEADER_ARCH is set (ARCH=um), the headers target spawns a recursive
> $(MAKE) -f $(srctree)/Makefile HEADER_ARCH= SRCARCH=$(HEADER_ARCH) headers.
> This re-runs $(version_h), scripts_unifdef, uapi-asm-generic, and
> archheaders a second time.
(...)
> Fixes: 268d191abc57 ("kbuild: implement CONFIG_HEADERS_INSTALL for Usermode Linux")
> Cc: stable@vger.kernel.org
> Link: https://lore.kernel.org/r/CAABy=s2iGODbNUdjYFd3MHLsTWsoN3_L5=v4aTX_wW4C3n1_Rg@mail.gmail.com
> Signed-off-by: HONG Yifan <elsk@google.com>
Reviewed-by: Thomas Weißschuh <linux@weissschuh.net>
> ---
> Makefile | 8 ++------
> 1 file changed, 2 insertions(+), 6 deletions(-)
(...)
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-12-05 12:04 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-04 23:21 [PATCH] kbuild: avoid recursive make headers when HEADER_ARCH is set HONG Yifan
2026-12-05 12:04 ` Thomas Weißschuh
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.