From: H.J. Lu Date: Sat, 21 Feb 2004 23:05:13 +0000 (+0000) Subject: 2004-02-21 H.J. Lu X-Git-Tag: gprof-pre-ansify-2004-05-26~1152 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1de1a3173e361471f4305b591475335d68ed3871;p=external%2Fbinutils.git 2004-02-21 H.J. Lu * elflink.c (_bfd_elf_merge_symbol): Properly handle undefined symbols with non-default visibility. --- diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 4c97561..94d1876 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,8 @@ +2004-02-21 H.J. Lu + + * elflink.c (_bfd_elf_merge_symbol): Properly handle undefined + symbols with non-default visibility. + 2004-02-21 Danny Smith * peXXigen.c (_bfd_XXi_swap_scnhdr_out): Clear diff --git a/bfd/elflink.c b/bfd/elflink.c index f58a67a..e605a8d 100644 --- a/bfd/elflink.c +++ b/bfd/elflink.c @@ -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;