On Tue, Mar 17, 2026 at 03:51:07PM -0700, Josh Poimboeuf wrote: > Split the objtool args into commands and options, such that if no > commands have been enabled, objtool doesn't run. > > This is in preparation in enabling objtool and klp-build for arm64. > > Reviewed-by: Nathan Chancellor <[email protected]> > Tested-by: Nathan Chancellor <[email protected]> > Signed-off-by: Josh Poimboeuf <[email protected]> > --- > arch/x86/boot/startup/Makefile | 2 +- > scripts/Makefile.build | 4 +-- > scripts/Makefile.lib | 46 ++++++++++++++++++---------------- > scripts/Makefile.vmlinux_o | 15 ++++------- > 4 files changed, 33 insertions(+), 34 deletions(-) > [...] > diff --git a/scripts/Makefile.build b/scripts/Makefile.build > index 3652b85be545..8a1bdfdb2fdb 100644 > --- a/scripts/Makefile.build > +++ b/scripts/Makefile.build > @@ -277,7 +277,7 @@ endif # CONFIG_FTRACE_MCOUNT_USE_RECORDMCOUNT > is-standard-object = $(if $(filter-out y%, > $(OBJECT_FILES_NON_STANDARD_$(target-stem).o)$(OBJECT_FILES_NON_STANDARD)n),$(is-kernel-object)) > > ifdef CONFIG_OBJTOOL > -$(obj)/%.o: private objtool-enabled = $(if $(is-standard-object),$(if > $(delay-objtool),$(is-single-obj-m),y)) > +$(obj)/%.o: private objtool-enabled = $(if $(is-standard-object),$(if > $(objtool-cmds-y),$(if $(delay-objtool),$(is-single-obj-m),y)))
Please use $(and a,b,c) instead of multiple nested $(if $(a),$(if $(b),$(c)); as the last variable (is-single-obj-m) is 'y' or empty, the final 'y' can be left-out: $(obj)/%.o: private objtool-enabled = $(and $(is-standard-object),$(objtool-cmds-y),$(delay-objtool),$(is-single-obj-m)) > endif > > ifneq ($(findstring 1, $(KBUILD_EXTRA_WARN)),) > @@ -501,7 +501,7 @@ define rule_ld_multi_m > $(call cmd,gen_objtooldep) > endef > > -$(multi-obj-m): private objtool-enabled := $(delay-objtool) > +$(multi-obj-m): private objtool-enabled := $(if > $(objtool-cmds-y),$(delay-objtool)) Could be changed to $(and), too; but personally I think the $(if) is easier to parse at once. Reviewed-by: Nicolas Schier <[email protected]> -- Nicolas

