2004-02-21 H.J. Lu <hongjiu.lu@intel.com>
authorH.J. Lu <hjl.tools@gmail.com>
Sat, 21 Feb 2004 23:05:13 +0000 (23:05 +0000)
committerH.J. Lu <hjl.tools@gmail.com>
Sat, 21 Feb 2004 23:05:13 +0000 (23:05 +0000)
* elflink.c (_bfd_elf_merge_symbol): Properly handle undefined
symbols with non-default visibility.

bfd/ChangeLog
bfd/elflink.c

index 4c97561dd33b8ce8a54ae4a96a3bbef72d073c7c..94d187649e3e265593553c6de353f82475bf1996 100644 (file)
@@ -1,3 +1,8 @@
+2004-02-21  H.J. Lu  <hongjiu.lu@intel.com>
+
+       * elflink.c (_bfd_elf_merge_symbol): Properly handle undefined
+       symbols with non-default visibility.
+
 2004-02-21  Danny Smith  <daanysmith@users.sourceforge.net>
 
        * peXXigen.c (_bfd_XXi_swap_scnhdr_out): Clear
index f58a67aade2f1818671afbe913cf383bcaf283f4..e605a8d2944cf712aa425095892abaf8c5c5151b 100644 (file)
@@ -843,8 +843,26 @@ _bfd_elf_merge_symbol (bfd *abfd,
         object, we remove the old definition.  */
       if ((*sym_hash)->root.type == bfd_link_hash_indirect)
        h = *sym_hash;
-      h->root.type = bfd_link_hash_new;
-      h->root.u.undef.abfd = NULL;
+
+      if ((h->root.und_next || info->hash->undefs_tail == &h->root)
+         && bfd_is_und_section (sec))
+       {
+         /* If the new symbol is undefined and the old symbol was
+            also undefined before, we need to make sure
+            _bfd_generic_link_add_one_symbol doesn't mess
+            up the linker hash table undefs list. Since the old
+            definition came from a dynamic object, it is still on the
+            undefs list.  */
+         h->root.type = bfd_link_hash_undefined;
+         /* FIXME: What if the new symbol is weak undefined?  */
+         h->root.u.undef.abfd = abfd;
+       }
+      else
+       {
+         h->root.type = bfd_link_hash_new;
+         h->root.u.undef.abfd = NULL;
+       }
+
       if (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC)
        {
          h->elf_link_hash_flags &= ~ELF_LINK_HASH_DEF_DYNAMIC;
This page took 0.029201 seconds and 4 git commands to generate.