aboutsummaryrefslogtreecommitdiff
path: root/ld/ldmain.c
diff options
context:
space:
mode:
authorDave Korn <dave.korn@artimi.com>2010-11-05 07:20:07 +0000
committerDave Korn <dave.korn@artimi.com>2010-11-05 07:20:07 +0000
commitd44ad554d42dd9e80692b0fd2a48b950d6a7a38e (patch)
tree987bf61e8b05d508a46bd6d738d8fd110fd69a02 /ld/ldmain.c
parentf4eaaf7fceed097ed62542f9940986b1de01aa48 (diff)
downloadgdb-d44ad554d42dd9e80692b0fd2a48b950d6a7a38e.zip
gdb-d44ad554d42dd9e80692b0fd2a48b950d6a7a38e.tar.gz
gdb-d44ad554d42dd9e80692b0fd2a48b950d6a7a38e.tar.bz2
* plugin.h (plugin_active_plugins_p): New prototype.
(is_ir_dummy_bfd): Delete prototype. * plugin.c: Fix formatting issues. (is_ir_dummy_bfd): Make static. (plugin_active_plugins_p): New function. * ldfile.c (ldfile_try_open_bfd): Use it to save work if no plugins are loaded. Always close file descriptor after claim handler returns. * ldmain.c (add_archive_element): Likewise.
Diffstat (limited to 'ld/ldmain.c')
-rw-r--r--ld/ldmain.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/ld/ldmain.c b/ld/ldmain.c
index 04b5633..e9b804a 100644
--- a/ld/ldmain.c
+++ b/ld/ldmain.c
@@ -809,7 +809,7 @@ add_archive_element (struct bfd_link_info *info,
BFD, but we still want to output the original BFD filename. */
orig_input = *input;
#ifdef ENABLE_PLUGINS
- if (bfd_my_archive (abfd) != NULL)
+ if (bfd_my_archive (abfd) != NULL && plugin_active_plugins_p ())
{
/* We must offer this archive member to the plugins to claim. */
int fd = open (bfd_my_archive (abfd)->filename, O_RDONLY | O_BINARY);
@@ -831,6 +831,8 @@ add_archive_element (struct bfd_link_info *info,
if (plugin_call_claim_file (&file, &claimed))
einfo (_("%P%F: %s: plugin reported error claiming file\n"),
plugin_error_plugin ());
+ /* fd belongs to us, not the plugin; but we don't need it. */
+ close (fd);
if (claimed)
{
/* Substitute the dummy BFD. */
@@ -843,7 +845,6 @@ add_archive_element (struct bfd_link_info *info,
{
/* Abandon the dummy BFD. */
bfd_close_all_done (file.handle);
- close (fd);
input->claimed = FALSE;
}
}