[PATCH 5/5] kbuild: rebuild *.lto.o when objtool is changed

Masahiro Yamada
2021-08-28T09:51:53Z

When objtool is changed, all objects are rebuilt, but this check
is missing in the %.lto.o rule.

Move the objtool-md5sum into the objtool variable so the updated
objtool is detected when CONFIG_LTO_CLANG=y as well.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
---

scripts/Makefile.build | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/scripts/Makefile.build b/scripts/Makefile.build
index cc0c494a48d3..790b72208668 100644
--- a/scripts/Makefile.build
+++ b/scripts/Makefile.build
@@ -225,7 +225,10 @@ endif # CONFIG_FTRACE_MCOUNT_USE_RECORDMCOUNT

ifdef CONFIG_STACK_VALIDATION

-objtool = $(objtree)/tools/objtool/objtool \
+# Record the md5sum of the objtool executable so any change in it results in
+# rebuilding objects.
+objtool = : $(objtool-md5sum) ; \
+ $(objtree)/tools/objtool/objtool \
$(if $(CONFIG_UNWINDER_ORC),orc generate,check) \
$(if $(part-of-module), --module) \
$(if $(CONFIG_FRAME_POINTER),, --no-fp) \
@@ -239,12 +242,9 @@ ifndef CONFIG_LTO_CLANG
# 'OBJECT_FILES_NON_STANDARD := y': skip objtool checking for a directory
# 'OBJECT_FILES_NON_STANDARD_foo.o := 'y': skip objtool checking for a file
# 'OBJECT_FILES_NON_STANDARD_foo.o := 'n': override directory skip for a file
-#
-# Record the md5sum of the objtool executable so any change in it results in
-# rebuilding objects.
cmd_objtool = $(if $(patsubst y%,, \
$(OBJECT_FILES_NON_STANDARD_$(basetarget).o)$(OBJECT_FILES_NON_STANDARD)n), \
- ; : $(objtool-md5sum) ; $(objtool) $@)
+ ; $(objtool) $@)

endif # CONFIG_LTO_CLANG
endif # CONFIG_STACK_VALIDATION
--
2.30.2