]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
* elflink.h (elf_fix_symbol_flags): Copy flags to weakdef using
authorAlan Modra <amodra@gmail.com>
Wed, 3 Oct 2001 08:33:18 +0000 (08:33 +0000)
committerAlan Modra <amodra@gmail.com>
Wed, 3 Oct 2001 08:33:18 +0000 (08:33 +0000)
elf_backend_copy_indirect_symbol so that backend has a chance to
copy other necessary fields.
* elf-bfd.h (struct elf_backend_data): Update description of
elf_backend_copy_indirect_symbol.
* elf.c (_bfd_elf_link_hash_copy_indirect): Bail out after
copying flags if this is a weakdef.
* elfxx-ia64.c (elfNN_ia64_hash_copy_indirect): Likewise.
(elfNN_ia64_aix_add_symbol_hook): Use elf_link_hash_lookup rather
than bfd_link_hash_lookup.
* elf32-i386 (elf_i386_adjust_dynamic_symbol): Don't do copy
reloc processing for weakdefs.
* elf32-hppa.c (elf32_hppa_adjust_dynamic_symbol): Likewise.
* elf64-ppc.c (ppc64_elf_adjust_dynamic_symbol): Likewise.

bfd/ChangeLog
bfd/elf-bfd.h
bfd/elf.c
bfd/elf32-hppa.c
bfd/elf32-i386.c
bfd/elf64-ppc.c
bfd/elflink.h
bfd/elfxx-ia64.c

index e60ffe6af306c36f2474b9e50cf039a408804cb4..0311dfb1d824ad61c68b7c573371e18df9198189 100644 (file)
@@ -1,3 +1,20 @@
+2001-10-03  Alan Modra  <amodra@bigpond.net.au>
+
+       * elflink.h (elf_fix_symbol_flags): Copy flags to weakdef using
+       elf_backend_copy_indirect_symbol so that backend has a chance to
+       copy other necessary fields.
+       * elf-bfd.h (struct elf_backend_data): Update description of
+       elf_backend_copy_indirect_symbol.
+       * elf.c (_bfd_elf_link_hash_copy_indirect): Bail out after
+       copying flags if this is a weakdef.
+       * elfxx-ia64.c (elfNN_ia64_hash_copy_indirect): Likewise.
+       (elfNN_ia64_aix_add_symbol_hook): Use elf_link_hash_lookup rather
+       than bfd_link_hash_lookup.
+       * elf32-i386 (elf_i386_adjust_dynamic_symbol): Don't do copy
+       reloc processing for weakdefs.
+       * elf32-hppa.c (elf32_hppa_adjust_dynamic_symbol): Likewise.
+       * elf64-ppc.c (ppc64_elf_adjust_dynamic_symbol): Likewise.
+
 2001-10-02  Alan Modra  <amodra@bigpond.net.au>
 
        * elf64-ppc.c (ppc64_elf_check_relocs): Use a local var and cast
index 42f8f29683f1ea7c334765533aefea8da5fda6f8..8ab13b7519b801a59dc67303ac9ae90d44352f5b 100644 (file)
@@ -648,8 +648,11 @@ struct elf_backend_data
     PARAMS ((bfd *, struct bfd_link_info *, PTR,
            boolean (*) (PTR, const char *, Elf_Internal_Sym *, asection *)));
 
-  /* Copy any information related to dynamic linking from a pre-existing
-     symbol IND to a newly created symbol DIR.  */
+  /* Copy any information related to dynamic linking from a pre-existing 
+     symbol to a newly created symbol.  Also called to copy flags and
+     other back-end info to a weakdef, in which case the symbol is not
+     newly created and plt/got refcounts and dynamic indices should not
+     be copied.  */
   void (*elf_backend_copy_indirect_symbol)
     PARAMS ((struct elf_link_hash_entry *, struct elf_link_hash_entry *));
 
index 826dbbbf021d7791fa1d8a3a396492e7dea0e5e5..289c06c8958ba67576ba71d03ac3e4c8abfdd111 100644 (file)
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -986,7 +986,7 @@ _bfd_elf_link_hash_newfunc (entry, table, string)
 }
 
 /* Copy data from an indirect symbol to its direct symbol, hiding the
-   old indirect symbol.  */
+   old indirect symbol.  Also used for copying flags to a weakdef.  */
 
 void
 _bfd_elf_link_hash_copy_indirect (dir, ind)
@@ -1004,6 +1004,9 @@ _bfd_elf_link_hash_copy_indirect (dir, ind)
        | ELF_LINK_HASH_REF_REGULAR_NONWEAK
        | ELF_LINK_NON_GOT_REF));
 
+  if (dir == ind->weakdef)
+    return;
+
   /* Copy over the global and procedure linkage table refcount entries.
      These may have been already set up by a check_relocs routine.  */
   tmp = dir->got.refcount;
index 8b662ab6d76cf862b1d759ddee316276396049f5..557b9fe4ca90a3a96b0383e635c1e363d64d16db 100644 (file)
@@ -1855,6 +1855,7 @@ elf32_hppa_adjust_dynamic_symbol (info, h)
        abort ();
       h->root.u.def.section = h->weakdef->root.u.def.section;
       h->root.u.def.value = h->weakdef->root.u.def.value;
+      return true;
     }
 
   /* This is a reference to a symbol defined by a dynamic object which
index 192aa4e36ef910886f7d260bc1cde9a65c25d0f3..719a209491a87d03d264dab1dfe5f1637c2d3749 100644 (file)
@@ -1109,6 +1109,7 @@ elf_i386_adjust_dynamic_symbol (info, h)
                  || h->weakdef->root.type == bfd_link_hash_defweak);
       h->root.u.def.section = h->weakdef->root.u.def.section;
       h->root.u.def.value = h->weakdef->root.u.def.value;
+      return true;
     }
 
   /* This is a reference to a symbol defined by a dynamic object which
index c314f5ee3c140548642991c12deccd4868a85db1..d3cdbecd8f55ff8027bbb28226ac8970206cd0dd 100644 (file)
@@ -2376,6 +2376,7 @@ ppc64_elf_adjust_dynamic_symbol (info, h)
                  || h->weakdef->root.type == bfd_link_hash_defweak);
       h->root.u.def.section = h->weakdef->root.u.def.section;
       h->root.u.def.value = h->weakdef->root.u.def.value;
+      return true;
     }
 
   /* This is a reference to a symbol defined by a dynamic object which
index 39f88119e3f9a8750116fbda68fb705da8f48c9e..3879dbcaa9458d06eb8cd78b23e798bab7413c60 100644 (file)
@@ -3615,11 +3615,12 @@ elf_fix_symbol_flags (h, eif)
       if ((weakdef->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) != 0)
        h->weakdef = NULL;
       else
-       weakdef->elf_link_hash_flags |=
-         (h->elf_link_hash_flags
-          & (ELF_LINK_HASH_REF_REGULAR
-             | ELF_LINK_HASH_REF_REGULAR_NONWEAK
-             | ELF_LINK_NON_GOT_REF));
+       {
+         struct elf_backend_data *bed;
+
+         bed = get_elf_backend_data (elf_hash_table (eif->info)->dynobj);
+         (*bed->elf_backend_copy_indirect_symbol) (weakdef, h);
+       }
     }
 
   return true;
index 739fe7a5aa67f780fc3bf78c76f9a6862c1d2e19..d467a980952e5bc0b3274b7c86f878c1af689701 100644 (file)
@@ -1190,7 +1190,8 @@ elfNN_ia64_aix_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp)
         no one else should use it b/c it is undocumented.  */
       struct elf_link_hash_entry *h;
 
-      h = (struct elf_link_hash_entry *) bfd_link_hash_lookup (info->hash, *namep, false, false, false);
+      h = elf_link_hash_lookup (elf_hash_table (info), *namep,
+                               false, false, false);
       if (h == NULL)
        {
          struct elf_backend_data *bed;
@@ -1523,6 +1524,9 @@ elfNN_ia64_hash_copy_indirect (xdir, xind)
         | ELF_LINK_HASH_REF_REGULAR
         | ELF_LINK_HASH_REF_REGULAR_NONWEAK));
 
+  if (dir == ind->weakdef)
+    return;
+
   /* Copy over the got and plt data.  This would have been done
      by check_relocs.  */