Message ID | 20220527100155.1996314-9-masahiroy@kernel.org (mailing list archive) |
---|---|
State | Not Applicable |
Headers | show |
Series | kbuild: yet another series of cleanups | expand |
On Fri, May 27, 2022 at 07:01:55PM +0900, Masahiro Yamada wrote: > When CONFIG_LTO_CLANG or CONFIG_X86_KERNEL_IBT is enabled, objtool for > multi-object modules is postponed until the objects are linked together. > > Make sure to re-run objtool and re-link multi-object modules when > objtool is updated. > > Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> > Reviewed-by: Kees Cook <keescook@chromium.org> > Acked-by: Josh Poimboeuf <jpoimboe@redhat.com> > Tested-by: Nathan Chancellor <nathan@kernel.org> > Reviewed-by: Nicolas Schier <n.schier@avm.de> > Tested-by: Sedat Dilek <sedat.dilek@gmail.com> # LLVM-14 (x86-64) Hi Masahiro, Is it also possible to rebuild vmlinux.o when objtool changes, for CONFIG_LTO_CLANG, CONFIG_X86_KERNEL_IBT, or CONFIG_NOINSTR_VALIDATION? That doesn't seem to be happening.
On Sat, May 28, 2022 at 12:50 AM Josh Poimboeuf <jpoimboe@kernel.org> wrote: > > On Fri, May 27, 2022 at 07:01:55PM +0900, Masahiro Yamada wrote: > > When CONFIG_LTO_CLANG or CONFIG_X86_KERNEL_IBT is enabled, objtool for > > multi-object modules is postponed until the objects are linked together. > > > > Make sure to re-run objtool and re-link multi-object modules when > > objtool is updated. > > > > Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> > > Reviewed-by: Kees Cook <keescook@chromium.org> > > Acked-by: Josh Poimboeuf <jpoimboe@redhat.com> > > Tested-by: Nathan Chancellor <nathan@kernel.org> > > Reviewed-by: Nicolas Schier <n.schier@avm.de> > > Tested-by: Sedat Dilek <sedat.dilek@gmail.com> # LLVM-14 (x86-64) > > Hi Masahiro, > > Is it also possible to rebuild vmlinux.o when objtool changes, for > CONFIG_LTO_CLANG, CONFIG_X86_KERNEL_IBT, or CONFIG_NOINSTR_VALIDATION? > That doesn't seem to be happening. > > -- > Josh Yes. Actually, it is already on my TODO list, but it requires more effort. I will aim for v5.20.
diff --git a/scripts/Makefile.build b/scripts/Makefile.build index 31feb798e16e..bd5fc2b37387 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build @@ -412,13 +412,18 @@ $(obj)/modules.order: $(obj-m) FORCE $(obj)/lib.a: $(lib-y) FORCE $(call if_changed,ar) -quiet_cmd_link_multi-m = LD [M] $@ - cmd_link_multi-m = $(LD) $(ld_flags) -r -o $@ @$(patsubst %.o,%.mod,$@) $(cmd_objtool) +quiet_cmd_ld_multi_m = LD [M] $@ + cmd_ld_multi_m = $(LD) $(ld_flags) -r -o $@ @$(patsubst %.o,%.mod,$@) $(cmd_objtool) + +define rule_ld_multi_m + $(call cmd_and_savecmd,ld_multi_m) + $(call cmd,gen_objtooldep) +endef $(multi-obj-m): objtool-enabled := $(delay-objtool) $(multi-obj-m): part-of-module := y $(multi-obj-m): %.o: %.mod FORCE - $(call if_changed,link_multi-m) + $(call if_changed_rule,ld_multi_m) $(call multi_depend, $(multi-obj-m), .o, -objs -y -m) targets := $(filter-out $(PHONY), $(targets))