* how to create early build deps?
@ 2025-04-17 2:55 Kees Cook
2025-04-25 8:25 ` Nicolas Schier
0 siblings, 1 reply; 3+ messages in thread
From: Kees Cook @ 2025-04-17 2:55 UTC (permalink / raw)
To: Masahiro Yamada; +Cc: linux-kbuild
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?
Thanks!
-Kees
[1] be2b34fa9be3 ("randstruct: Move seed generation into scripts/basic/")
--
Kees Cook
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: how to create early build deps?
2025-04-17 2:55 how to create early build deps? Kees Cook
@ 2025-04-25 8:25 ` Nicolas Schier
2025-04-29 12:49 ` Nicolas Schier
0 siblings, 1 reply; 3+ messages in thread
From: Nicolas Schier @ 2025-04-25 8:25 UTC (permalink / raw)
To: Kees Cook; +Cc: Masahiro Yamada, linux-kbuild
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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: how to create early build deps?
2025-04-25 8:25 ` Nicolas Schier
@ 2025-04-29 12:49 ` Nicolas Schier
0 siblings, 0 replies; 3+ messages in thread
From: Nicolas Schier @ 2025-04-29 12:49 UTC (permalink / raw)
To: Kees Cook; +Cc: Masahiro Yamada, linux-kbuild
[-- Attachment #1: Type: text/plain, Size: 1502 bytes --]
On Fri, 25 Apr 2025, Nicolas Schier wrote:
[...]
> > 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.
well, touching fixdep would really not be a nice option. I'll send a
patch that forces the rebuild by adding
include/generated/randstruct_hash.h to include/linux/compiler-version.h.
Thanks for the report!
Kind regards,
Nicolas
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-04-29 12:54 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-17 2:55 how to create early build deps? Kees Cook
2025-04-25 8:25 ` Nicolas Schier
2025-04-29 12:49 ` Nicolas Schier
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox