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

Configure Feed

Select the types of activity you want to include in your feed.

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: Masahiro Yamada <masahiroy@kernel.org>
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>

+3 -7
+3 -7
scripts/Makefile.build
··· 450 450 $(obj)/lib.a: $(lib-y) FORCE 451 451 $(call if_changed,ar_lib) 452 452 453 - # NOTE: 454 - # Do not replace $(filter %.o,^) with $(real-prereqs). When a single object 455 - # module is turned into a multi object module, $^ will contain header file 456 - # dependencies recorded in the .*.cmd file. 457 453 ifneq ($(CONFIG_LTO_CLANG)$(CONFIG_X86_KERNEL_IBT),) 458 454 quiet_cmd_link_multi-m = AR [M] $@ 459 455 cmd_link_multi-m = \ 460 456 $(cmd_update_lto_symversions); \ 461 457 rm -f $@; \ 462 - $(AR) cDPrsT $@ $(filter %.o,$^) 458 + $(AR) cDPrsT $@ @$(patsubst %.o,%.mod,$@) 463 459 else 464 460 quiet_cmd_link_multi-m = LD [M] $@ 465 - cmd_link_multi-m = $(LD) $(ld_flags) -r -o $@ $(filter %.o,$^) 461 + cmd_link_multi-m = $(LD) $(ld_flags) -r -o $@ @$(patsubst %.o,%.mod,$@) 466 462 endif 467 463 468 - $(multi-obj-m): FORCE 464 + $(multi-obj-m): %.o: %.mod FORCE 469 465 $(call if_changed,link_multi-m) 470 466 $(call multi_depend, $(multi-obj-m), .o, -objs -y -m) 471 467