This is the mail archive of the
binutils-cvs@sourceware.org
mailing list for the binutils project.
[binutils-gdb] Don't bfd_check_format if not needed
- From: H.J.Lu <hjl at sourceware dot org>
- To: bfd-cvs at sourceware dot org
- Date: 8 Feb 2015 23:01:45 -0000
- Subject: [binutils-gdb] Don't bfd_check_format if not needed
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=1d5b29cfe459ceb6d0965ca3ab8936e0d72e1fd5
commit 1d5b29cfe459ceb6d0965ca3ab8936e0d72e1fd5
Author: H.J. Lu <hjl.tools@gmail.com>
Date: Sun Feb 8 15:00:34 2015 -0800
Don't bfd_check_format if not needed
When plugin isn't active or there is no thing more to claim, we don't
need to call bfd_check_format.
* ldfile.c (ldfile_try_open_bfd): Don't call bfd_check_format
if plugin isn't active or there is no thing more to claim.
Diff:
---
ld/ChangeLog | 5 +++++
ld/ldfile.c | 6 +++---
2 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/ld/ChangeLog b/ld/ChangeLog
index 856249b..bf59ab3 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,5 +1,10 @@
2015-02-08 H.J. Lu <hongjiu.lu@intel.com>
+ * ldfile.c (ldfile_try_open_bfd): Don't call bfd_check_format
+ if plugin isn't active or there is no thing more to claim.
+
+2015-02-08 H.J. Lu <hongjiu.lu@intel.com>
+
* plugin.c (plugin_maybe_claim): Check format against bfd_object
directly.
diff --git a/ld/ldfile.c b/ld/ldfile.c
index 05889f2..e19f55e 100644
--- a/ld/ldfile.c
+++ b/ld/ldfile.c
@@ -301,9 +301,9 @@ success:
bfd_object that it sets the bfd's arch and mach, which
will be needed when and if we want to bfd_create a new
one using this one as a template. */
- if (bfd_check_format (entry->the_bfd, bfd_object)
- && link_info.lto_plugin_active
- && !no_more_claiming)
+ if (link_info.lto_plugin_active
+ && !no_more_claiming
+ && bfd_check_format (entry->the_bfd, bfd_object))
plugin_maybe_claim (entry);
#endif /* ENABLE_PLUGINS */