bfd_cleanup for object_p
[deliverable/binutils-gdb.git] / bfd / plugin.c
index 93d562b9fed31c692533ae9247ae18211327b065..a0f172d363793753601db6afa892c97f79da0aab 100644 (file)
@@ -147,6 +147,17 @@ struct plugin_list_entry
   bfd_boolean initialized;
 };
 
+static const char *plugin_program_name;
+static int need_lto_wrapper_p;
+
+void
+bfd_plugin_set_program_name (const char *program_name,
+                            int need_lto_wrapper)
+{
+  plugin_program_name = program_name;
+  need_lto_wrapper_p = need_lto_wrapper;
+}
+
 /* Use GCC LTO wrapper to covert LTO IR object to the real object.  */
 
 static bfd_boolean
@@ -165,6 +176,9 @@ get_lto_wrapper (struct plugin_list_entry *plugin)
   char dir_seperator = '\0';
   char *resolution_file;
 
+  if (!need_lto_wrapper_p)
+    return FALSE;
+
   if (plugin->initialized)
     {
       if (plugin->lto_wrapper)
@@ -489,14 +503,6 @@ add_symbols (void * handle,
   return LDPS_OK;
 }
 
-static const char *plugin_program_name;
-
-void
-bfd_plugin_set_program_name (const char *program_name)
-{
-  plugin_program_name = program_name;
-}
-
 int
 bfd_plugin_open_input (bfd *ibfd, struct ld_plugin_input_file *file)
 {
@@ -719,7 +725,7 @@ try_load_plugin (const char *pname,
   abfd->plugin_format = bfd_plugin_yes;
   result = 1;
 
-short_circuit:
+ short_circuit:
   dlclose (plugin_handle);
   return result;
 }
@@ -727,7 +733,7 @@ short_circuit:
 /* There may be plugin libraries in lib/bfd-plugins.  */
 static int has_plugin_list = -1;
 
-static const bfd_target *(*ld_plugin_object_p) (bfd *);
+static bfd_cleanup (*ld_plugin_object_p) (bfd *);
 
 static const char *plugin_name;
 
@@ -768,7 +774,7 @@ bfd_plugin_target_p (const bfd_target *target)
 /* Register OBJECT_P to be used by bfd_plugin_object_p.  */
 
 void
-register_ld_plugin_object_p (const bfd_target *(*object_p) (bfd *))
+register_ld_plugin_object_p (bfd_cleanup (*object_p) (bfd *))
 {
   ld_plugin_object_p = object_p;
 }
@@ -856,7 +862,7 @@ load_plugin (bfd *abfd)
 }
 
 
-static const bfd_target *
+static bfd_cleanup
 bfd_plugin_object_p (bfd *abfd)
 {
   if (ld_plugin_object_p)
@@ -865,7 +871,7 @@ bfd_plugin_object_p (bfd *abfd)
   if (abfd->plugin_format == bfd_plugin_unknown && !load_plugin (abfd))
     return NULL;
 
-  return abfd->plugin_format == bfd_plugin_yes ? abfd->xvec : NULL;
+  return abfd->plugin_format == bfd_plugin_yes ? _bfd_no_cleanup : NULL;
 }
 
 /* Copy any private info we understand from the input bfd
This page took 0.026038 seconds and 4 git commands to generate.