aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2020-02-25 03:30:33 -0800
committerAndreas K. Huettel <dilfridge@gentoo.org>2020-02-29 18:42:22 +0100
commite463d55a635360aaaa5e3c05b85fc304ac769e69 (patch)
treef6967260331aa54e57cbfe8dbe44948264e012c6
parentAutomatic date update in version.in (diff)
downloadbinutils-gdb-e463d55a635360aaaa5e3c05b85fc304ac769e69.tar.gz
binutils-gdb-e463d55a635360aaaa5e3c05b85fc304ac769e69.tar.bz2
binutils-gdb-e463d55a635360aaaa5e3c05b85fc304ac769e69.zip
Don't call lto-wrapper for ar and ranlib
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. (cherry picked from commit ecda90163e2b0a6f0be96e3fc262c28820a27211)
-rw-r--r--bfd/ChangeLog10
-rw-r--r--bfd/plugin.c22
-rw-r--r--bfd/plugin.h2
-rw-r--r--binutils/ChangeLog6
-rw-r--r--binutils/ar.c2
-rw-r--r--binutils/nm.c2
6 files changed, 33 insertions, 11 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index e5da1b4658..51eda90af1 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -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-22 Alan Modra <amodra@gmail.com>
PR 25585
diff --git a/bfd/plugin.c b/bfd/plugin.c
index 93d562b9fe..c79468fab8 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 05c3573933..b2d5e50137 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/ChangeLog b/binutils/ChangeLog
index 068b2dbb16..24b0515fd6 100644
--- a/binutils/ChangeLog
+++ b/binutils/ChangeLog
@@ -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-01 Nick Clifton <nickc@redhat.com>
* configure: Regenerate.
diff --git a/binutils/ar.c b/binutils/ar.c
index 1057db9980..35dd51e04a 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 0ee3f88386..5b386592a6 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);