aboutsummaryrefslogtreecommitdiff
path: root/ld/plugin.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/plugin.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/plugin.c')
-rw-r--r--ld/plugin.c24
1 files changed, 18 insertions, 6 deletions
diff --git a/ld/plugin.c b/ld/plugin.c
index 1e280e4..ea64788 100644
--- a/ld/plugin.c
+++ b/ld/plugin.c
@@ -172,13 +172,15 @@ plugin_error_p (void)
}
/* Return name of plugin which caused an error if any. */
-const char *plugin_error_plugin (void)
+const char *
+plugin_error_plugin (void)
{
return error_plugin ? error_plugin : _("<no plugin>");
}
/* Handle -plugin arg: find and load plugin, or return error. */
-int plugin_opt_plugin (const char *plugin)
+int
+plugin_opt_plugin (const char *plugin)
{
plugin_t *newplug;
@@ -201,7 +203,8 @@ int plugin_opt_plugin (const char *plugin)
/* Accumulate option arguments for last-loaded plugin, or return
error if none. */
-int plugin_opt_plugin_arg (const char *arg)
+int
+plugin_opt_plugin_arg (const char *arg)
{
plugin_arg_t *newarg;
@@ -241,8 +244,8 @@ plugin_get_ir_dummy_bfd (const char *name, bfd *srctemplate)
return abfd;
}
-/* Check if the BFD is an IR dummy. */
-bfd_boolean
+/* Check if the BFD passed in is an IR dummy object file. */
+static bfd_boolean
is_ir_dummy_bfd (const bfd *abfd)
{
size_t namlen;
@@ -615,8 +618,17 @@ set_tv_plugin_args (plugin_t *plugin, struct ld_plugin_tv *tv)
tv->tv_u.tv_val = 0;
}
+/* Return true if any plugins are active this run. Only valid
+ after options have been processed. */
+bfd_boolean
+plugin_active_plugins_p (void)
+{
+ return plugins_list != NULL;
+}
+
/* Load up and initialise all plugins after argument parsing. */
-int plugin_load_plugins (void)
+int
+plugin_load_plugins (void)
{
struct ld_plugin_tv *my_tv;
unsigned int max_args = 0;