From: "H.J. Lu" <hjl.tools@gmail.com>
To: Binutils <binutils@sourceware.org>, Alan Modra <amodra@gmail.com>,
Nick Clifton <nickc@redhat.com>
Subject: Re: [PATCH] Don't call lto-wrapper for ar and ranlib
Date: Mon, 24 Feb 2020 12:59:00 -0000 [thread overview]
Message-ID: <CAMe9rOoZVRWDpw1RefCYHG6N9tXv63TM5zRG+TgJMWWgJkn6SA@mail.gmail.com> (raw)
In-Reply-To: <20200221132043.275391-1-hjl.tools@gmail.com>
On Fri, Feb 21, 2020 at 5:20 AM H.J. Lu <hjl.tools@gmail.com> wrote:
>
> Since ar and ranlib don't need to know symbol types to work properly,
> we should avoid calling lto-wrapper for them to speed them up.
Nick, Alan, is this patch OK for master?
Nick, is this patch OK for backport to 2.34 branch?
Thanks.
> bfd/
>
> PR binutils/25584
> * plugin.c (need_lto_wrapper_p): New.
> (bfd_plugin_set_program_name): Add an int argument to set
> need_lto_wrapper_p.
> (get_lto_wrapper): Return FALSE if need_lto_wrapper_p isn't
> set.
> * plugin.h (bfd_plugin_set_program_name): Add an int argument.
>
> binutils/
>
> PR binutils/25584
> * ar.c (main): Pass 0 to bfd_plugin_set_program_name.
> * nm.c (main): Pass 1 to bfd_plugin_set_program_name.
> ---
> bfd/plugin.c | 22 ++++++++++++++--------
> bfd/plugin.h | 2 +-
> binutils/ar.c | 2 +-
> binutils/nm.c | 2 +-
> 4 files changed, 17 insertions(+), 11 deletions(-)
>
> diff --git a/bfd/plugin.c b/bfd/plugin.c
> index 93d562b9fed..c79468fab87 100644
> --- a/bfd/plugin.c
> +++ b/bfd/plugin.c
> @@ -147,6 +147,17 @@ struct plugin_list_entry
> bfd_boolean initialized;
> };
>
> +static const char *plugin_program_name;
> +static int need_lto_wrapper_p;
> +
> +void
> +bfd_plugin_set_program_name (const char *program_name,
> + int need_lto_wrapper)
> +{
> + plugin_program_name = program_name;
> + need_lto_wrapper_p = need_lto_wrapper;
> +}
> +
> /* Use GCC LTO wrapper to covert LTO IR object to the real object. */
>
> static bfd_boolean
> @@ -165,6 +176,9 @@ get_lto_wrapper (struct plugin_list_entry *plugin)
> char dir_seperator = '\0';
> char *resolution_file;
>
> + if (!need_lto_wrapper_p)
> + return FALSE;
> +
> if (plugin->initialized)
> {
> if (plugin->lto_wrapper)
> @@ -489,14 +503,6 @@ add_symbols (void * handle,
> return LDPS_OK;
> }
>
> -static const char *plugin_program_name;
> -
> -void
> -bfd_plugin_set_program_name (const char *program_name)
> -{
> - plugin_program_name = program_name;
> -}
> -
> int
> bfd_plugin_open_input (bfd *ibfd, struct ld_plugin_input_file *file)
> {
> diff --git a/bfd/plugin.h b/bfd/plugin.h
> index 05c3573933d..b2d5e50137f 100644
> --- a/bfd/plugin.h
> +++ b/bfd/plugin.h
> @@ -21,7 +21,7 @@
> #ifndef _PLUGIN_H_
> #define _PLUGIN_H_
>
> -void bfd_plugin_set_program_name (const char *);
> +void bfd_plugin_set_program_name (const char *, int);
> int bfd_plugin_open_input (bfd *, struct ld_plugin_input_file *);
> void bfd_plugin_set_plugin (const char *);
> bfd_boolean bfd_plugin_target_p (const bfd_target *);
> diff --git a/binutils/ar.c b/binutils/ar.c
> index 1057db9980e..35dd51e04af 100644
> --- a/binutils/ar.c
> +++ b/binutils/ar.c
> @@ -725,7 +725,7 @@ main (int argc, char **argv)
> xmalloc_set_program_name (program_name);
> bfd_set_error_program_name (program_name);
> #if BFD_SUPPORTS_PLUGINS
> - bfd_plugin_set_program_name (program_name);
> + bfd_plugin_set_program_name (program_name, 0);
> #endif
>
> expandargv (&argc, &argv);
> diff --git a/binutils/nm.c b/binutils/nm.c
> index 0ee3f883865..5b386592a61 100644
> --- a/binutils/nm.c
> +++ b/binutils/nm.c
> @@ -1701,7 +1701,7 @@ main (int argc, char **argv)
> xmalloc_set_program_name (program_name);
> bfd_set_error_program_name (program_name);
> #if BFD_SUPPORTS_PLUGINS
> - bfd_plugin_set_program_name (program_name);
> + bfd_plugin_set_program_name (program_name, 1);
> #endif
>
> START_PROGRESS (program_name, 0);
> --
> 2.24.1
>
--
H.J.
next prev parent reply other threads:[~2020-02-24 12:59 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-21 13:20 H.J. Lu
2020-02-24 12:59 ` H.J. Lu [this message]
2020-02-24 23:41 ` Alan Modra
2020-02-25 14:46 ` Nick Clifton
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=CAMe9rOoZVRWDpw1RefCYHG6N9tXv63TM5zRG+TgJMWWgJkn6SA@mail.gmail.com \
--to=hjl.tools@gmail.com \
--cc=amodra@gmail.com \
--cc=binutils@sourceware.org \
--cc=nickc@redhat.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 read-only IMAP folder(s) and NNTP newsgroup(s).