From: Nicolas Schier <nicolas@fjasle.eu>
To: Kees Cook <kees@kernel.org>
Cc: Masahiro Yamada <masahiroy@kernel.org>, linux-kbuild@vger.kernel.org
Subject: Re: how to create early build deps?
Date: Fri, 25 Apr 2025 10:25:38 +0200 [thread overview]
Message-ID: <20250425-bouncy-logical-ringtail-4d879a@lindesnes> (raw)
In-Reply-To: <202504161928.17A90D9B@keescook>
Hi Kees,
On Wed, Apr 16, 2025 at 07:55:02PM -0700, Kees Cook wrote:
> Hi!
>
> I am stumped...
>
> I swear there was a time when changing the gcc-plugins would trigger a
> full rebuild of all kernel sources. I tried to bisect where that stopped
> happening, but it went back far enough that things stopped building with
> my compiler at all. ;)
>
> Anyway, I need this also for the Clang randstruct seed file -- if it
> changes, we need to rebuild everything. I thought this worked back in
> v5.19 when I moved the randstruct seed generation into scripts/basic[1],
> but regenerating it doesn't trigger a rebuild (with v5.19 nor current
> Linus nor linux-next):
>
> $ make O=clang-all LLVM=1 allmodconfig kernel/seccomp.o
> make[1]: Entering directory '/srv/code/clang-all'
> ...
> GENSEED scripts/basic/randstruct.seed
> ...
> CC kernel/seccomp.o
> make[1]: Leaving directory '/srv/code/clang-all'
>
> $ rm clang-all/scripts/basic/randstruct.seed
>
> $ make O=clang-all LLVM=1 kernel/seccomp.o
> make[1]: Entering directory '/srv/code/clang-all'
> GEN Makefile
> GENSEED scripts/basic/randstruct.seed
> DESCEND objtool
> CALL ../scripts/checksyscalls.sh
> INSTALL libsubcmd_headers
> make[1]: Leaving directory '/srv/code/clang-all'
>
> kernel/seccomp.o doesn't get rebuilt :(
>
> By what mechanism can I convince kbuild to rebuild everything if
> randstruct.seed (or the gcc-plugins) are changed?
I think the easiest way to achieve a full rebuild due to changes in
scripts/basic/randstruct.seed would be to let it show up in
.$(target).cmd. Limited testing with a very hacky thing like
diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include
index 8c311b997e24..1aceedfe0791 100644
--- a/scripts/Kbuild.include
+++ b/scripts/Kbuild.include
@@ -206,4 +206,5 @@ if_changed_dep = $(if $(if-changed-cond),$(cmd_and_fixdep),@:)
cmd_and_fixdep = \
$(cmd); \
$(objtree)/scripts/basic/fixdep $(depfile) $@ '$(make-cmd)' > $(dot-target).cmd;\
+ sed -i -re 's,../include/linux/compiler.h,& $(objtree)/scripts/basic/randstruct.seed,' $(dot-target).cmd ;\
rm -f $(depfile)
looks promising to me. But as far as I can see, fixdep does not have
similar hard-coded dependencies included, yet. Thus I am unsure if
fixdep is really the this we want to touch for randstruct.seed.
Kind regards,
Nicolas
next prev parent reply other threads:[~2025-04-25 8:25 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-17 2:55 how to create early build deps? Kees Cook
2025-04-25 8:25 ` Nicolas Schier [this message]
2025-04-29 12:49 ` 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=20250425-bouncy-logical-ringtail-4d879a@lindesnes \
--to=nicolas@fjasle.eu \
--cc=kees@kernel.org \
--cc=linux-kbuild@vger.kernel.org \
--cc=masahiroy@kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox