Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

kbuild: remove unneeded link_multi_deps

Since commit c8589d1e9e01 ("kbuild: handle multi-objs dependency
appropriately"), $^ really represents all the prerequisite of the
composite object being built.

Hence, $(filter %.o,$^) contains all the objects to link together,
which is much simpler than link_multi_deps calculation.

Please note $(filter-out FORCE,$^) does not work here. When a single
object module is turned into a multi object module, $^ will contain
header files that were previously included for building the single
object, and recorded in the .*.cmd file. To filter out such headers,
$(filter %.o,$^) should be used here.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

+2 -18
+2 -18
scripts/Makefile.build
··· 485 485 486 486 endif 487 487 488 - # 489 - # Rule to link composite objects 490 - # 491 - # Composite objects are specified in kbuild makefile as follows: 492 - # <composite-object>-objs := <list of .o files> 493 - # or 494 - # <composite-object>-y := <list of .o files> 495 - # or 496 - # <composite-object>-m := <list of .o files> 497 - # The -m syntax only works if <composite object> is a module 498 - link_multi_deps = \ 499 - $(filter $(addprefix $(obj)/, \ 500 - $($(subst $(obj)/,,$(@:.o=-objs))) \ 501 - $($(subst $(obj)/,,$(@:.o=-y))) \ 502 - $($(subst $(obj)/,,$(@:.o=-m)))), $^) 503 - 504 488 quiet_cmd_link_multi-m = LD [M] $@ 505 - cmd_link_multi-m = $(LD) $(ld_flags) -r -o $@ $(link_multi_deps) $(cmd_secanalysis) 489 + cmd_link_multi-m = $(LD) $(ld_flags) -r -o $@ $(filter %.o,$^) $(cmd_secanalysis) 506 490 507 491 $(multi-used-m): FORCE 508 492 $(call if_changed,link_multi-m) 509 - @{ echo $(@:.o=.ko); echo $(link_multi_deps); \ 493 + @{ echo $(@:.o=.ko); echo $(filter %.o,$^); \ 510 494 $(cmd_undef_syms); } > $(MODVERDIR)/$(@F:.o=.mod) 511 495 $(call multi_depend, $(multi-used-m), .o, -objs -y -m) 512 496