Commit f6b66ca4 authored by Masahiro Yamada's avatar Masahiro Yamada

kbuild: rebuild multi-object modules when objtool is updated

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: default avatarMasahiro Yamada <masahiroy@kernel.org>
Reviewed-by: default avatarKees Cook <keescook@chromium.org>
Acked-by: default avatarJosh Poimboeuf <jpoimboe@redhat.com>
Tested-by: default avatarNathan Chancellor <nathan@kernel.org>
Reviewed-by: default avatarNicolas Schier <n.schier@avm.de>
Tested-by: Sedat Dilek <sedat.dilek@gmail.com> # LLVM-14 (x86-64)
parent ebd191b3
...@@ -413,13 +413,18 @@ $(obj)/modules.order: $(obj-m) FORCE ...@@ -413,13 +413,18 @@ $(obj)/modules.order: $(obj-m) FORCE
$(obj)/lib.a: $(lib-y) FORCE $(obj)/lib.a: $(lib-y) FORCE
$(call if_changed,ar) $(call if_changed,ar)
quiet_cmd_link_multi-m = LD [M] $@ quiet_cmd_ld_multi_m = LD [M] $@
cmd_link_multi-m = $(LD) $(ld_flags) -r -o $@ @$(patsubst %.o,%.mod,$@) $(cmd_objtool) 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): objtool-enabled := $(delay-objtool)
$(multi-obj-m): part-of-module := y $(multi-obj-m): part-of-module := y
$(multi-obj-m): %.o: %.mod FORCE $(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) $(call multi_depend, $(multi-obj-m), .o, -objs -y -m)
targets := $(filter-out $(PHONY), $(targets)) targets := $(filter-out $(PHONY), $(targets))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment