From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 70503 invoked by alias); 24 Feb 2020 12:59:20 -0000 Mailing-List: contact binutils-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: binutils-owner@sourceware.org Received: (qmail 70492 invoked by uid 89); 24 Feb 2020 12:59:19 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-15.0 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.1 spammy=H*Ad:U*amodra, HTo:U*amodra, HTo:U*nickc, HX-Spam-Relays-External:209.85.167.193 X-HELO: mail-oi1-f193.google.com Received: from mail-oi1-f193.google.com (HELO mail-oi1-f193.google.com) (209.85.167.193) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 24 Feb 2020 12:59:18 +0000 Received: by mail-oi1-f193.google.com with SMTP id a22so8798786oid.13 for ; Mon, 24 Feb 2020 04:59:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=WPFqVh2CgYIJ7Ngwx050rt6NTM3DyBBEmZQ7K4EAzFs=; b=AG+M57Lcq09pWeA+qlJYsiXMRpc/XoBpWypppp4tb4/Pbkj+YCpp8yJtnmiDn9ZbIZ jx66oxym8tIu/bctWxaBIWM7tWAIr+o24R+2t+UyhDCXR+Rw2LLJ78xpMZOfi6TXGoyZ zkXqfIQnq2qMVay9l0ijgbF7pE4VxlxXiSgeRWS/gmaPm3dnJgb92vGcFSONJdDVVev6 psSZ+ToYO68ZiP6/9qg7TOMs1sP1pGGpaqXhQWtWFCX9hVua0H2Z6vCgfFqlYvW33q+g kP3jBtUIaNW2OVBWWeaVB0MNHEF25xyj9AWHQW05bTu9g974DEacI6YtoCKe8uxpe8cP 6ZJw== MIME-Version: 1.0 References: <20200221132043.275391-1-hjl.tools@gmail.com> In-Reply-To: <20200221132043.275391-1-hjl.tools@gmail.com> From: "H.J. Lu" Date: Mon, 24 Feb 2020 12:59:00 -0000 Message-ID: Subject: Re: [PATCH] Don't call lto-wrapper for ar and ranlib To: Binutils , Alan Modra , Nick Clifton Content-Type: text/plain; charset="UTF-8" X-IsSubscribed: yes X-SW-Source: 2020-02/txt/msg00528.txt.bz2 On Fri, Feb 21, 2020 at 5:20 AM H.J. Lu 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.