summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorH.J. Lu <hjl@lucon.org>2004-02-21 23:05:13 +0000
committerH.J. Lu <hjl@lucon.org>2004-02-21 23:05:13 +0000
commit07fe477f90fbbb2136eb6609b12c3f04fa5fe751 (patch)
tree72dca45d9b325e1471b94d03879c43a62f3bbcb3
parent6b744e23a847a0a5d621dfe55b9544514fb2286c (diff)
downloadbinutils-redhat-07fe477f90fbbb2136eb6609b12c3f04fa5fe751.tar.gz
2004-02-21 H.J. Lu <hongjiu.lu@intel.com>
* elflink.c (_bfd_elf_merge_symbol): Properly handle undefined symbols with non-default visibility.
-rw-r--r--bfd/ChangeLog5
-rw-r--r--bfd/elflink.c22
2 files changed, 25 insertions, 2 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 4c97561dd3..94d187649e 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -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
diff --git a/bfd/elflink.c b/bfd/elflink.c
index f58a67aade..e605a8d294 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;