* [PATCH v2] kbuild: remove unneeded link_multi_deps
@ 2018-10-04 4:25 Masahiro Yamada
2018-10-09 14:59 ` Masahiro Yamada
0 siblings, 1 reply; 2+ messages in thread
From: Masahiro Yamada @ 2018-10-04 4:25 UTC (permalink / raw)
To: linux-kbuild; +Cc: Masahiro Yamada, Michal Marek, linux-kernel
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. $(filter %.o,$^)
should be used to filter out such headers.
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
---
Changes in v2:
- Fix regression reported in linux-next.
https://www.mail-archive.com/linux-kernel@vger.kernel.org/msg1779047.html
scripts/Makefile.build | 20 ++------------------
1 file changed, 2 insertions(+), 18 deletions(-)
diff --git a/scripts/Makefile.build b/scripts/Makefile.build
index cb03774..f21b48d 100644
--- a/scripts/Makefile.build
+++ b/scripts/Makefile.build
@@ -485,28 +485,12 @@ targets += $(obj)/lib-ksyms.o
endif
-#
-# Rule to link composite objects
-#
-# Composite objects are specified in kbuild makefile as follows:
-# <composite-object>-objs := <list of .o files>
-# or
-# <composite-object>-y := <list of .o files>
-# or
-# <composite-object>-m := <list of .o files>
-# The -m syntax only works if <composite object> is a module
-link_multi_deps = \
-$(filter $(addprefix $(obj)/, \
-$($(subst $(obj)/,,$(@:.o=-objs))) \
-$($(subst $(obj)/,,$(@:.o=-y))) \
-$($(subst $(obj)/,,$(@:.o=-m)))), $^)
-
quiet_cmd_link_multi-m = LD [M] $@
-cmd_link_multi-m = $(LD) $(ld_flags) -r -o $@ $(link_multi_deps) $(cmd_secanalysis)
+cmd_link_multi-m = $(LD) $(ld_flags) -r -o $@ $(filter %.o,$^) $(cmd_secanalysis)
$(multi-used-m): FORCE
$(call if_changed,link_multi-m)
- @{ echo $(@:.o=.ko); echo $(link_multi_deps); \
+ @{ echo $(@:.o=.ko); echo $(filter %.o,$^); \
$(cmd_undef_syms); } > $(MODVERDIR)/$(@F:.o=.mod)
$(call multi_depend, $(multi-used-m), .o, -objs -y -m)
--
2.7.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v2] kbuild: remove unneeded link_multi_deps
2018-10-04 4:25 [PATCH v2] kbuild: remove unneeded link_multi_deps Masahiro Yamada
@ 2018-10-09 14:59 ` Masahiro Yamada
0 siblings, 0 replies; 2+ messages in thread
From: Masahiro Yamada @ 2018-10-09 14:59 UTC (permalink / raw)
To: Linux Kbuild mailing list; +Cc: Michal Marek, Linux Kernel Mailing List
On Thu, Oct 4, 2018 at 1:25 PM Masahiro Yamada
<yamada.masahiro@socionext.com> wrote:
>
> 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. $(filter %.o,$^)
> should be used to filter out such headers.
>
> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
> ---
>
> Changes in v2:
> - Fix regression reported in linux-next.
> https://www.mail-archive.com/linux-kernel@vger.kernel.org/msg1779047.html
V2 replaced V1.
> scripts/Makefile.build | 20 ++------------------
> 1 file changed, 2 insertions(+), 18 deletions(-)
>
> diff --git a/scripts/Makefile.build b/scripts/Makefile.build
> index cb03774..f21b48d 100644
> --- a/scripts/Makefile.build
> +++ b/scripts/Makefile.build
> @@ -485,28 +485,12 @@ targets += $(obj)/lib-ksyms.o
>
> endif
>
> -#
> -# Rule to link composite objects
> -#
> -# Composite objects are specified in kbuild makefile as follows:
> -# <composite-object>-objs := <list of .o files>
> -# or
> -# <composite-object>-y := <list of .o files>
> -# or
> -# <composite-object>-m := <list of .o files>
> -# The -m syntax only works if <composite object> is a module
> -link_multi_deps = \
> -$(filter $(addprefix $(obj)/, \
> -$($(subst $(obj)/,,$(@:.o=-objs))) \
> -$($(subst $(obj)/,,$(@:.o=-y))) \
> -$($(subst $(obj)/,,$(@:.o=-m)))), $^)
> -
> quiet_cmd_link_multi-m = LD [M] $@
> -cmd_link_multi-m = $(LD) $(ld_flags) -r -o $@ $(link_multi_deps) $(cmd_secanalysis)
> +cmd_link_multi-m = $(LD) $(ld_flags) -r -o $@ $(filter %.o,$^) $(cmd_secanalysis)
>
> $(multi-used-m): FORCE
> $(call if_changed,link_multi-m)
> - @{ echo $(@:.o=.ko); echo $(link_multi_deps); \
> + @{ echo $(@:.o=.ko); echo $(filter %.o,$^); \
> $(cmd_undef_syms); } > $(MODVERDIR)/$(@F:.o=.mod)
> $(call multi_depend, $(multi-used-m), .o, -objs -y -m)
>
> --
> 2.7.4
>
--
Best Regards
Masahiro Yamada
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-10-09 15:00 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-04 4:25 [PATCH v2] kbuild: remove unneeded link_multi_deps Masahiro Yamada
2018-10-09 14:59 ` Masahiro Yamada
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).