From: Kees Cook <keescook@chromium.org>
To: Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: linux-kbuild <linux-kbuild@vger.kernel.org>,
Kernel Hardening <kernel-hardening@lists.openwall.com>,
Emese Revfy <re.emese@gmail.com>,
Michal Marek <michal.lkml@markovi.net>,
LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 1/2] kbuild: clean up hostprogs rules with hostld_flags and hostld_libs
Date: Fri, 11 Jan 2019 09:20:25 -0800 [thread overview]
Message-ID: <CAGXu5jJzkqvyhZbCiQFHDZ3v36j2bM3_y_RMCof97rA35Z6opw@mail.gmail.com> (raw)
In-Reply-To: <1547198328-26359-1-git-send-email-yamada.masahiro@socionext.com>
On Fri, Jan 11, 2019 at 1:19 AM Masahiro Yamada
<yamada.masahiro@socionext.com> wrote:
>
> Add hostld_flags and hostld_libs shorthands. No function change.
>
> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Acked-by: Kees Cook <keescook@chromium.org>
-Kees
> ---
>
> scripts/Makefile.host | 23 +++++++++++++----------
> 1 file changed, 13 insertions(+), 10 deletions(-)
>
> diff --git a/scripts/Makefile.host b/scripts/Makefile.host
> index 0393f75..f2e15de 100644
> --- a/scripts/Makefile.host
> +++ b/scripts/Makefile.host
> @@ -78,23 +78,26 @@ endif
> hostc_flags = -Wp,-MD,$(depfile) $(__hostc_flags)
> hostcxx_flags = -Wp,-MD,$(depfile) $(__hostcxx_flags)
>
> +hostld_flags = $(KBUILD_HOSTLDFLAGS)
> +hostld_libs = $(KBUILD_HOSTLDLIBS) $(HOSTLDLIBS_$(@F))
> +
> #####
> # Compile programs on the host
>
> # Create executable from a single .c file
> # host-csingle -> Executable
> quiet_cmd_host-csingle = HOSTCC $@
> - cmd_host-csingle = $(HOSTCC) $(hostc_flags) $(KBUILD_HOSTLDFLAGS) -o $@ $< \
> - $(KBUILD_HOSTLDLIBS) $(HOSTLDLIBS_$(@F))
> + cmd_host-csingle = $(HOSTCC) $(hostc_flags) $(hostld_flags) -o $@ $< \
> + $(hostld_libs)
> $(host-csingle): $(obj)/%: $(src)/%.c FORCE
> $(call if_changed_dep,host-csingle)
>
> # Link an executable based on list of .o files, all plain c
> # host-cmulti -> executable
> quiet_cmd_host-cmulti = HOSTLD $@
> - cmd_host-cmulti = $(HOSTCC) $(KBUILD_HOSTLDFLAGS) -o $@ \
> + cmd_host-cmulti = $(HOSTCC) $(hostld_flags) -o $@ \
> $(addprefix $(obj)/,$($(@F)-objs)) \
> - $(KBUILD_HOSTLDLIBS) $(HOSTLDLIBS_$(@F))
> + $(hostld_libs)
> $(host-cmulti): FORCE
> $(call if_changed,host-cmulti)
> $(call multi_depend, $(host-cmulti), , -objs)
> @@ -109,10 +112,10 @@ $(host-cobjs): $(obj)/%.o: $(src)/%.c FORCE
> # Link an executable based on list of .o files, a mixture of .c and .cc
> # host-cxxmulti -> executable
> quiet_cmd_host-cxxmulti = HOSTLD $@
> - cmd_host-cxxmulti = $(HOSTCXX) $(KBUILD_HOSTLDFLAGS) -o $@ \
> + cmd_host-cxxmulti = $(HOSTCXX) $(hostld_flags) -o $@ \
> $(foreach o,objs cxxobjs,\
> $(addprefix $(obj)/,$($(@F)-$(o)))) \
> - $(KBUILD_HOSTLDLIBS) $(HOSTLDLIBS_$(@F))
> + $(hostld_libs)
> $(host-cxxmulti): FORCE
> $(call if_changed,host-cxxmulti)
> $(call multi_depend, $(host-cxxmulti), , -objs -cxxobjs)
> @@ -143,9 +146,9 @@ $(host-cxxshobjs): $(obj)/%.o: $(src)/%.c FORCE
> # Link a shared library, based on position independent .o files
> # *.o -> .so shared library (host-cshlib)
> quiet_cmd_host-cshlib = HOSTLLD -shared $@
> - cmd_host-cshlib = $(HOSTCC) $(KBUILD_HOSTLDFLAGS) -shared -o $@ \
> + cmd_host-cshlib = $(HOSTCC) $(hostld_flags) -shared -o $@ \
> $(addprefix $(obj)/,$($(@F:.so=-objs))) \
> - $(KBUILD_HOSTLDLIBS) $(HOSTLDLIBS_$(@F))
> + $(hostld_libs)
> $(host-cshlib): FORCE
> $(call if_changed,host-cshlib)
> $(call multi_depend, $(host-cshlib), .so, -objs)
> @@ -153,9 +156,9 @@ $(call multi_depend, $(host-cshlib), .so, -objs)
> # Link a shared library, based on position independent .o files
> # *.o -> .so shared library (host-cxxshlib)
> quiet_cmd_host-cxxshlib = HOSTLLD -shared $@
> - cmd_host-cxxshlib = $(HOSTCXX) $(KBUILD_HOSTLDFLAGS) -shared -o $@ \
> + cmd_host-cxxshlib = $(HOSTCXX) $(hostld_flags) -shared -o $@ \
> $(addprefix $(obj)/,$($(@F:.so=-objs))) \
> - $(KBUILD_HOSTLDLIBS) $(HOSTLDLIBS_$(@F))
> + $(hostld_libs)
> $(host-cxxshlib): FORCE
> $(call if_changed,host-cxxshlib)
> $(call multi_depend, $(host-cxxshlib), .so, -objs)
> --
> 2.7.4
>
--
Kees Cook
prev parent reply other threads:[~2019-01-11 17:20 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-11 9:18 [PATCH 1/2] kbuild: clean up hostprogs rules with hostld_flags and hostld_libs Masahiro Yamada
2019-01-11 9:18 ` [PATCH 2/2] kbuild: simplify GCC plugin build rules Masahiro Yamada
2019-01-11 17:20 ` Kees Cook
2019-01-11 17:20 ` Kees Cook [this message]
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=CAGXu5jJzkqvyhZbCiQFHDZ3v36j2bM3_y_RMCof97rA35Z6opw@mail.gmail.com \
--to=keescook@chromium.org \
--cc=kernel-hardening@lists.openwall.com \
--cc=linux-kbuild@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=michal.lkml@markovi.net \
--cc=re.emese@gmail.com \
--cc=yamada.masahiro@socionext.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;
as well as URLs for NNTP newsgroup(s).