aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2004-02-21 23:05:13 +0000
committerH.J. Lu <hjl.tools@gmail.com>2004-02-21 23:05:13 +0000
commit1de1a3173e361471f4305b591475335d68ed3871 (patch)
tree0a29de1c1a6d9212e418ae4ba2926459c1fe2127 /bfd
parent464a129bc839c0f5341fbc0900268632795fa810 (diff)
downloadgdb-1de1a3173e361471f4305b591475335d68ed3871.zip
gdb-1de1a3173e361471f4305b591475335d68ed3871.tar.gz
gdb-1de1a3173e361471f4305b591475335d68ed3871.tar.bz2
2004-02-21 H.J. Lu <hongjiu.lu@intel.com>
* elflink.c (_bfd_elf_merge_symbol): Properly handle undefined symbols with non-default visibility.
Diffstat (limited to 'bfd')
-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 4c97561..94d1876 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 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;