aboutsummaryrefslogtreecommitdiff
path: root/gcc/plugin.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/plugin.c')
-rw-r--r--gcc/plugin.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/gcc/plugin.c b/gcc/plugin.c
index cfd6ef2..c6d3cdd 100644
--- a/gcc/plugin.c
+++ b/gcc/plugin.c
@@ -617,6 +617,7 @@ try_init_one_plugin (struct plugin_name_args *plugin)
if ((err = dlerror ()) != NULL)
{
+ dlclose(dl_handle);
error ("cannot find %s in plugin %s\n%s", str_plugin_init_func_name,
plugin->full_name, err);
return false;
@@ -625,10 +626,12 @@ try_init_one_plugin (struct plugin_name_args *plugin)
/* Call the plugin-provided initialization routine with the arguments. */
if ((*plugin_init) (plugin, &gcc_version))
{
+ dlclose(dl_handle);
error ("fail to initialize plugin %s", plugin->full_name);
return false;
}
-
+ /* leak dl_handle on purpose to ensure the plugin is loaded for the
+ entire run of the compiler. */
return true;
}