From: Nicolas Schier <nsc@kernel.org>
To: sashiko-reviews@lists.linux.dev
Cc: Vincent Mailhol <mailhol@kernel.org>,
Nathan Chancellor <nathan@kernel.org>,
linux-kbuild@vger.kernel.org
Subject: Re: [PATCH 3/3] kbuild: move scripts/mod target out of single-build
Date: Mon, 23 Nov 2026 17:52:35 +0100 [thread overview]
Message-ID: <awRvU8_wAUlkd1Nj@levanger> (raw)
In-Reply-To: <sashiko-outbox-211218@kernel.org>
On Thu, Nov 12, 2026 at 01:45:43PM +0000, sashiko-bot@kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found 1 potential
> issue to consider:
> - [Low] kbuild: unordered modpost_prepare and stack_protector_prepare
> mutates CFLAGS
> --
>
> commit 08ffc13380249741520c2ea434688d701b5d0e9b
> Author: Vincent Mailhol <mailhol@kernel.org>
>
> kbuild: move scripts/mod target out of single-build
>
> This commit moves the scripts/mod build out of prepare0 into a new
> modpost_prepare target depended on by modules_prepare and modpost.
>
> > diff --git a/Makefile b/Makefile
> > index 2c1289a44c560..93236f310f080 100644
> > --- a/Makefile
> > +++ b/Makefile
> > @@ -1405,7 +1405,7 @@ scripts: scripts_basic scripts_dtc
> > # archprepare is used in arch Makefiles and when processed asm symlink,
> > # version.h and scripts_basic is processed / created.
> >
> > -PHONY += prepare archprepare
> > +PHONY += prepare archprepare modpost_prepare
> >
> > archprepare: outputmakefile archheaders archscripts scripts include/config/kernel.release \
> > asm-generic $(version_h) include/generated/utsrelease.h \
> > @@ -1414,6 +1414,8 @@ archprepare: outputmakefile archheaders archscripts scripts include/config/kerne
> >
> > prepare0: archprepare
> > $(Q)$(MAKE) $(build)=. prepare $(if $(single-build),,prepare_checks)
> > +
> > +modpost_prepare: archprepare
> > $(Q)$(MAKE) $(build)=scripts/mod
>
> [Severity: Low]
> Should modpost_prepare be ordered relative to stack_protector_prepare (or
> depend on prepare)?
>
> On arm, arm64, powerpc, and riscv, prepare depends on
> stack_protector_prepare, which depends on prepare0 and mutates the
> exported KBUILD_CFLAGS variable at recipe execution time:
>
> arch/arm64/Makefile:
> prepare: stack_protector_prepare
> stack_protector_prepare: prepare0
> $(eval KBUILD_CFLAGS += -mstack-protector-guard=sysreg \
> -mstack-protector-guard-reg=sp_el0 \
> -mstack-protector-guard-offset=$(shell \
> awk '{if ($$2 == "TSK_STACK_CANARY") print $$3;}' \
> $(objtree)/include/generated/asm-offsets.h))
>
> Previously, scripts/mod was built inside prepare0, so it always ran before
> stack_protector_prepare modified KBUILD_CFLAGS. With modpost_prepare
> only depending on archprepare, a parallel build runs modpost_prepare
> concurrently with prepare0 before stack_protector_prepare updates
> KBUILD_CFLAGS, whereas a serial build or make modules_prepare runs
> prepare first and passes the updated KBUILD_CFLAGS to scripts/mod.
>
> Because scripts/mod/empty.o is compiled with KBUILD_CFLAGS, switching
> between parallel and serial or single-module builds changes its recorded
> command line, rebuilding empty.o, regenerating elfconfig.h (which uses
> if_changed), and forcing a full rebuild of modpost.
Well yes,
make scripts/mod/empty.o && make modules
leads to a rebuild of empty.o and modpost triggered by 'make modules'.
But if that is the only negative implication, this is not relevant as I
expect no human wants to build scripts/mod/empty.o as a single-target.
--
Nicolas
next prev parent reply other threads:[~2026-11-23 16:53 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-11 13:41 [PATCH 0/3] kbuild: reduce single-build dependencies Vincent Mailhol
2026-11-11 13:41 ` [PATCH 1/3] kbuild: make rq-offsets-file an explicit preparation dependency Vincent Mailhol
2026-11-11 13:41 ` [PATCH 2/3] kbuild: move preparation checks out of single-build Vincent Mailhol
2026-11-11 13:41 ` [PATCH 3/3] kbuild: move scripts/mod target " Vincent Mailhol
2026-11-12 13:45 ` sashiko-bot
2026-11-23 16:52 ` Nicolas Schier [this message]
2026-11-24 7:24 ` Vincent Mailhol
2026-11-23 16:53 ` [PATCH 0/3] kbuild: reduce single-build dependencies Nicolas Schier
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=awRvU8_wAUlkd1Nj@levanger \
--to=nsc@kernel.org \
--cc=linux-kbuild@vger.kernel.org \
--cc=mailhol@kernel.org \
--cc=nathan@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.