Support fusion for ELFv2 stubs
[binutils-gdb.git] / ld / plugin.c
index 435f4663b2bd042f32ea4f445673594d83e6bd96..2a6d7c5f545b50eac7a0d4bc992fc9b61db0b7b2 100644 (file)
@@ -1,5 +1,5 @@
 /* Plugin control for the GNU linker.
-   Copyright 2010, 2011, 2012 Free Software Foundation, Inc.
+   Copyright (C) 2010-2014 Free Software Foundation, Inc.
 
    This file is part of the GNU Binutils.
 
@@ -429,20 +429,18 @@ add_symbols (void *handle, int nsyms, const struct ld_plugin_symbol *syms)
 /* Get the input file information with an open (possibly re-opened)
    file descriptor.  */
 static enum ld_plugin_status
-get_input_file (const void *handle, struct ld_plugin_input_file *file)
+get_input_file (const void *handle ATTRIBUTE_UNUSED,
+                struct ld_plugin_input_file *file ATTRIBUTE_UNUSED)
 {
   ASSERT (called_plugin);
-  handle = handle;
-  file = file;
   return LDPS_ERR;
 }
 
 /* Release the input file.  */
 static enum ld_plugin_status
-release_input_file (const void *handle)
+release_input_file (const void *handle ATTRIBUTE_UNUSED)
 {
   ASSERT (called_plugin);
-  handle = handle;
   return LDPS_ERR;
 }
 
@@ -993,7 +991,15 @@ plugin_notice (struct bfd_link_info *info,
 
       /* If this is a ref, set non_ir_ref.  */
       else if (bfd_is_und_section (section))
-       h->non_ir_ref = TRUE;
+       {
+         /* Replace the undefined dummy bfd with the real one.  */
+         if ((h->type == bfd_link_hash_undefined
+              || h->type == bfd_link_hash_undefweak)
+             && (h->u.undef.abfd == NULL
+                 || (h->u.undef.abfd->flags & BFD_PLUGIN) != 0))
+           h->u.undef.abfd = abfd;
+         h->non_ir_ref = TRUE;
+       }
 
       /* Otherwise, it must be a new def.  Ensure any symbol defined
         in an IR dummy BFD takes on a new value from a real BFD.