public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jeff Johnson <quic_jjohnson@quicinc.com>
To: Masahiro Yamada <masahiroy@kernel.org>, <linux-kbuild@vger.kernel.org>
Cc: <linux-kernel@vger.kernel.org>,
	Michal Marek <michal.lkml@markovi.net>,
	Nick Desaulniers <ndesaulniers@google.com>
Subject: Re: [PATCH 7/7] kbuild: read *.mod to get objects passed to $(LD) or $(AR)
Date: Wed, 6 Apr 2022 11:13:18 -0700	[thread overview]
Message-ID: <960102bb-2944-4be0-ab09-7cd2eb0c2cf9@quicinc.com> (raw)
In-Reply-To: <20220406153023.500847-8-masahiroy@kernel.org>

On 4/6/2022 8:30 AM, Masahiro Yamada wrote:
> 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>
> ---
> 
>   scripts/Makefile.build | 10 +++-------
>   1 file changed, 3 insertions(+), 7 deletions(-)
> 
> diff --git a/scripts/Makefile.build b/scripts/Makefile.build
> index 3da731cf6978..f6a506318795 100644
> --- a/scripts/Makefile.build
> +++ b/scripts/Makefile.build
> @@ -450,22 +450,18 @@ quiet_cmd_ar_lib = AR      $@
>   $(obj)/lib.a: $(lib-y) FORCE
>   	$(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),)
>   quiet_cmd_link_multi-m = AR [M]  $@
>   cmd_link_multi-m =						\
>   	$(cmd_update_lto_symversions);				\
>   	rm -f $@; 						\
> -	$(AR) cDPrsT $@ $(filter %.o,$^)
> +	$(AR) cDPrsT $@ @$(patsubst %.o,%.mod,$@)
>   else
>   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
>   
> -$(multi-obj-m): FORCE
> +$(multi-obj-m): %.o: %.mod FORCE
>   	$(call if_changed,link_multi-m)
>   $(call multi_depend, $(multi-obj-m), .o, -objs -y -m)
>   

Looks like this also addresses the out-of-tree issue described in 
<https://lore.kernel.org/linux-kbuild/1610500731-30960-2-git-send-email-jjohnson@codeaurora.org/>

:)

/jeff

  reply	other threads:[~2022-04-06 19:39 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-06 15:30 [PATCH 0/7] kbuild: more misc cleanups Masahiro Yamada
2022-04-06 15:30 ` [PATCH 1/7] kbuild: reuse suffix-search to refactor multi_depend Masahiro Yamada
2022-04-06 20:54   ` Nick Desaulniers
2022-04-06 15:30 ` [PATCH 2/7] kbuild: make multi_depend work with targets in subdirectory Masahiro Yamada
2022-04-07 17:34   ` Nick Desaulniers
2022-04-06 15:30 ` [PATCH 3/7] kbuild: reuse real-search to simplify cmd_mod Masahiro Yamada
2022-04-07 17:38   ` Nick Desaulniers
2022-04-06 15:30 ` [PATCH 4/7] kbuild: split the second line of *.mod into *.usyms Masahiro Yamada
2022-04-07 17:47   ` Nick Desaulniers
2022-04-07 23:56     ` Masahiro Yamada
2022-04-06 15:30 ` [PATCH 5/7] kbuild: get rid of duplication in *.mod files Masahiro Yamada
2022-04-07 17:55   ` Nick Desaulniers
2022-04-08  0:07     ` Masahiro Yamada
2022-04-08 20:42       ` Nick Desaulniers
2022-04-13  8:19         ` Masahiro Yamada
2022-04-06 15:30 ` [PATCH 6/7] kbuild: make *.mod not depend on *.o Masahiro Yamada
2022-04-07 17:59   ` Nick Desaulniers
2022-04-07 21:39     ` David Laight
2022-04-08  0:37       ` Masahiro Yamada
2022-04-08  2:37         ` Masahiro Yamada
2022-04-06 15:30 ` [PATCH 7/7] kbuild: read *.mod to get objects passed to $(LD) or $(AR) Masahiro Yamada
2022-04-06 18:13   ` Jeff Johnson [this message]
2022-04-07  3:07     ` Masahiro Yamada
2022-04-07 18:01   ` Nick Desaulniers
2022-04-15  7:20 ` [PATCH 0/7] kbuild: more misc cleanups Masahiro Yamada
2022-04-22 19:07   ` Elliot Berman
2022-04-23  5:02     ` Masahiro Yamada

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=960102bb-2944-4be0-ab09-7cd2eb0c2cf9@quicinc.com \
    --to=quic_jjohnson@quicinc.com \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=masahiroy@kernel.org \
    --cc=michal.lkml@markovi.net \
    --cc=ndesaulniers@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox