aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bfd/ChangeLog5
-rw-r--r--bfd/elflink.h19
2 files changed, 20 insertions, 4 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index d7f8b76..1c0014f 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -5,6 +5,11 @@ Thu Dec 12 15:07:20 1996 Michael Meissner <meissner@tiktok.cygnus.com>
Thu Dec 12 14:55:41 1996 Ian Lance Taylor <ian@cygnus.com>
+ * elflink.h (elf_link_add_object_symbols): Only add a weak
+ symbol if the real definition is in the dynamic symbol table.
+ After finding the real definition, then, if it is dynamic, add the
+ weak symbol to the dynamic symbol table.
+
* coff-aux.c (coff_m68k_aux_link_add_one_symbol): Make static.
* ppcboot.c (ppcboot_set_arch_mach): Don't define; it's a
diff --git a/bfd/elflink.h b/bfd/elflink.h
index 8be2f2d..5097b4c 100644
--- a/bfd/elflink.h
+++ b/bfd/elflink.h
@@ -810,8 +810,7 @@ elf_link_add_object_symbols (abfd, info)
reference or definition we just found. Keep a count of
the number of dynamic symbols we find. A dynamic symbol
is one which is referenced or defined by both a regular
- object and a shared object, or one which is referenced or
- defined by more than one shared object. */
+ object and a shared object. */
old_flags = h->elf_link_hash_flags;
dynsym = false;
if (! dynamic)
@@ -834,8 +833,8 @@ elf_link_add_object_symbols (abfd, info)
if ((old_flags & (ELF_LINK_HASH_DEF_REGULAR
| ELF_LINK_HASH_REF_REGULAR)) != 0
|| (h->weakdef != NULL
- && (old_flags & (ELF_LINK_HASH_DEF_DYNAMIC
- | ELF_LINK_HASH_REF_DYNAMIC)) != 0))
+ && ! new_weakdef
+ && h->weakdef->dynindx != -1))
dynsym = true;
}
@@ -912,6 +911,18 @@ elf_link_add_object_symbols (abfd, info)
goto error_return;
}
+ /* If the real definition is in the list of dynamic
+ symbols, make sure the weak definition is put there
+ as well. If we don't do this, then the dynamic
+ loader might not merge the entries for the real
+ definition and the weak definition. */
+ if (h->dynindx != -1
+ && hlook->dynindx == -1)
+ {
+ if (! _bfd_elf_link_record_dynamic_symbol (info, hlook))
+ goto error_return;
+ }
+
break;
}
}