diff options
Diffstat (limited to 'ld/plugin.c')
-rw-r--r-- | ld/plugin.c | 30 |
1 files changed, 17 insertions, 13 deletions
diff --git a/ld/plugin.c b/ld/plugin.c index 8902ef4..da99e77 100644 --- a/ld/plugin.c +++ b/ld/plugin.c @@ -155,6 +155,14 @@ dlclose (void *handle) #endif /* !defined (HAVE_DLFCN_H) && defined (HAVE_WINDOWS_H) */ +#ifndef HAVE_DLFCN_H +static const char * +dlerror (void) +{ + return ""; +} +#endif + /* Helper function for exiting with error status. */ static int set_plugin_error (const char *plugin) @@ -178,7 +186,7 @@ plugin_error_plugin (void) } /* Handle -plugin arg: find and load plugin, or return error. */ -int +void plugin_opt_plugin (const char *plugin) { plugin_t *newplug; @@ -188,7 +196,7 @@ plugin_opt_plugin (const char *plugin) newplug->name = plugin; newplug->dlhandle = dlopen (plugin, RTLD_NOW); if (!newplug->dlhandle) - return set_plugin_error (plugin); + einfo (_("%P%F: %s: error loading plugin: %s\n"), plugin, dlerror ()); /* Chain on end, so when we run list it is in command-line order. */ *plugins_tail_chain_ptr = newplug; @@ -197,7 +205,6 @@ plugin_opt_plugin (const char *plugin) /* Record it as current plugin for receiving args. */ last_plugin = newplug; last_plugin_args_tail_chain_ptr = &newplug->args; - return 0; } /* Accumulate option arguments for last-loaded plugin, or return @@ -771,7 +778,7 @@ plugin_active_plugins_p (void) } /* Load up and initialise all plugins after argument parsing. */ -int +void plugin_load_plugins (void) { struct ld_plugin_tv *my_tv; @@ -780,7 +787,7 @@ plugin_load_plugins (void) /* If there are no plugins, we need do nothing this run. */ if (!curplug) - return 0; + return; /* First pass over plugins to find max # args needed so that we can size and allocate the tv array. */ @@ -806,13 +813,14 @@ plugin_load_plugins (void) if (!onloadfn) onloadfn = (ld_plugin_onload) dlsym (curplug->dlhandle, "_onload"); if (!onloadfn) - return set_plugin_error (curplug->name); + einfo (_("%P%F: %s: error loading plugin: %s\n"), + curplug->name, dlerror ()); set_tv_plugin_args (curplug, &my_tv[tv_header_size]); called_plugin = curplug; rv = (*onloadfn) (my_tv); called_plugin = NULL; if (rv != LDPS_OK) - return set_plugin_error (curplug->name); + einfo (_("%P%F: %s: plugin error: %d\n"), curplug->name, rv); curplug = curplug->next; } @@ -825,8 +833,6 @@ plugin_load_plugins (void) plugin_callbacks.notice = &plugin_notice; link_info.notice_all = TRUE; link_info.callbacks = &plugin_callbacks; - - return 0; } /* Call 'claim file' hook for all plugins. */ @@ -929,14 +935,12 @@ plugin_call_cleanup (void) rv = (*curplug->cleanup_handler) (); called_plugin = NULL; if (rv != LDPS_OK) - set_plugin_error (curplug->name); + info_msg (_("%P: %s: error in plugin cleanup: %d (ignored)\n"), + curplug->name, rv); dlclose (curplug->dlhandle); } curplug = curplug->next; } - if (plugin_error_p ()) - info_msg (_("%P: %s: error in plugin cleanup (ignored)\n"), - plugin_error_plugin ()); } /* To determine which symbols should be resolved LDPR_PREVAILING_DEF |