ld: Fix LTO for MinGW targets
[deliverable/binutils-gdb.git] / ld / plugin.c
index 8e53255ecd485dc59e4be392deecc54bb85e7bfc..b0e2a5f7a70764a0c359d35e1ae86b3504be9f62 100644 (file)
@@ -295,16 +295,18 @@ static bfd *
 plugin_get_ir_dummy_bfd (const char *name, bfd *srctemplate)
 {
   bfd *abfd;
+  bfd_boolean bfd_plugin_target;
 
   bfd_use_reserved_id = 1;
+  bfd_plugin_target = bfd_plugin_target_p (srctemplate->xvec);
   abfd = bfd_create (concat (name, IRONLY_SUFFIX, (const char *) NULL),
-                    link_info.output_bfd);
+                    bfd_plugin_target ? link_info.output_bfd : srctemplate);
   if (abfd != NULL)
     {
       abfd->flags |= BFD_LINKER_CREATED | BFD_PLUGIN;
       if (!bfd_make_writable (abfd))
        goto report_error;
-      if (! bfd_plugin_target_p (srctemplate->xvec))
+      if (!bfd_plugin_target)
        {
          bfd_set_arch_info (abfd, bfd_get_arch_info (srctemplate));
          bfd_set_gp_size (abfd, bfd_get_gp_size (srctemplate));
This page took 0.024752 seconds and 4 git commands to generate.