提交 feb7d79f 编写于 作者: M Masahiro Yamada

kbuild: read *.mod to get objects passed to $(LD) or $(AR)

ld and ar support @file, which command-line options are read from.

Now that *.mod lists the member objects in the correct order, without
duplication, it is ready to be passed to ld and ar.

By using the @file syntax, people will not be worried about the pitfall
described in the NOTE.
Signed-off-by: NMasahiro Yamada <masahiroy@kernel.org>
Reviewed-by: NNick Desaulniers <ndesaulniers@google.com>
上级 fc93a4cd
...@@ -450,22 +450,18 @@ quiet_cmd_ar_lib = AR $@ ...@@ -450,22 +450,18 @@ quiet_cmd_ar_lib = AR $@
$(obj)/lib.a: $(lib-y) FORCE $(obj)/lib.a: $(lib-y) FORCE
$(call if_changed,ar_lib) $(call if_changed,ar_lib)
# NOTE:
# Do not replace $(filter %.o,^) with $(real-prereqs). When a single object
# module is turned into a multi object module, $^ will contain header file
# dependencies recorded in the .*.cmd file.
ifneq ($(CONFIG_LTO_CLANG)$(CONFIG_X86_KERNEL_IBT),) ifneq ($(CONFIG_LTO_CLANG)$(CONFIG_X86_KERNEL_IBT),)
quiet_cmd_link_multi-m = AR [M] $@ quiet_cmd_link_multi-m = AR [M] $@
cmd_link_multi-m = \ cmd_link_multi-m = \
$(cmd_update_lto_symversions); \ $(cmd_update_lto_symversions); \
rm -f $@; \ rm -f $@; \
$(AR) cDPrsT $@ $(filter %.o,$^) $(AR) cDPrsT $@ @$(patsubst %.o,%.mod,$@)
else else
quiet_cmd_link_multi-m = LD [M] $@ quiet_cmd_link_multi-m = LD [M] $@
cmd_link_multi-m = $(LD) $(ld_flags) -r -o $@ $(filter %.o,$^) cmd_link_multi-m = $(LD) $(ld_flags) -r -o $@ @$(patsubst %.o,%.mod,$@)
endif endif
$(multi-obj-m): FORCE $(multi-obj-m): %.o: %.mod FORCE
$(call if_changed,link_multi-m) $(call if_changed,link_multi-m)
$(call multi_depend, $(multi-obj-m), .o, -objs -y -m) $(call multi_depend, $(multi-obj-m), .o, -objs -y -m)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册