Don't call lto-wrapper for ar and ranlib
authorH.J. Lu <hjl.tools@gmail.com>
Tue, 25 Feb 2020 11:30:33 +0000 (03:30 -0800)
committerH.J. Lu <hjl.tools@gmail.com>
Tue, 25 Feb 2020 11:31:40 +0000 (03:31 -0800)
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.

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/ChangeLog
bfd/plugin.c
bfd/plugin.h
binutils/ChangeLog
binutils/ar.c
binutils/nm.c

index eeb042c32f39b08e0b0f6a4905e96e7364b0b412..7e8e454632ce6bb2802ec19f7698798044ba4f50 100644 (file)
@@ -1,3 +1,13 @@
+2020-02-25  H.J. Lu  <hongjiu.lu@intel.com>
+
+       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.
+
 2020-02-24  Alan Modra  <amodra@gmail.com>
 
        * vms-lib.c (_bfd_vms_lib_archive_p): Correct overflow checks.
index 93d562b9fed31c692533ae9247ae18211327b065..c79468fab87c37b7b1e9647d19735e307f1b6590 100644 (file)
@@ -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)
 {
index 05c3573933dc5929a9472e3a104263a52cf33cdd..b2d5e50137f2c30b436c3c14d3017d38676b6b5b 100644 (file)
@@ -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 *);
index 3cda3fd743989cd54702a38ea5c5d77cdfbf00b0..dbb8fe070783a0a92b5b62bd0d863631b599baa6 100644 (file)
@@ -1,3 +1,9 @@
+2020-02-25  H.J. Lu  <hongjiu.lu@intel.com>
+
+       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.
+
 2020-02-24  Nick Clifton  <nickc@redhat.com>
 
        PR 25499
index 1057db9980eddc4559ce5d8c253ddf483a29e1f5..35dd51e04af48ecbd5d514faea3405bd08de1cc4 100644 (file)
@@ -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);
index 0ee3f8838654adb39054f1ad64cc4eab2b4cc288..5b386592a615c4b9decb8647db06fa7cb01e641b 100644 (file)
@@ -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);
This page took 0.029448 seconds and 4 git commands to generate.