aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@airs.com>1997-04-02 22:47:29 +0000
committerIan Lance Taylor <ian@airs.com>1997-04-02 22:47:29 +0000
commitba254dc504f848de3eef9af6162344675f5cd09f (patch)
tree2a32a4ae9ae63769fc0eac5bacea4f81b9df655c
parent9909707740ace434078d19bbb2d34fbb2ba907d0 (diff)
downloadgdb-ba254dc504f848de3eef9af6162344675f5cd09f.zip
gdb-ba254dc504f848de3eef9af6162344675f5cd09f.tar.gz
gdb-ba254dc504f848de3eef9af6162344675f5cd09f.tar.bz2
Revert last patch, and:
* elflink.h (elf_link_add_object_symbols): Let a common symbol override an uninitialized symbol from a shared library with a smaller size.
-rw-r--r--bfd/ChangeLog5
-rw-r--r--bfd/elflink.h26
2 files changed, 17 insertions, 14 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index b79c57c..463810b 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -6,8 +6,9 @@ Wed Apr 2 16:19:41 1997 Mike Meissner <meissner@cygnus.com>
Wed Apr 2 10:49:07 1997 Ian Lance Taylor <ian@cygnus.com>
- * elflink.h (elf_link_add_object_symbols): When there is a size
- change, use the larger size. From H.J. Lu <hjl@gnu.ai.mit.edu>.
+ * elflink.h (elf_link_add_object_symbols): Let a common symbol
+ override an uninitialized symbol from a shared library with a
+ smaller size.
* elf-m10200.c: Rename from elf32-mn10200.c.
* elf-m10300.c: Rename from elf32-mn10300.c.
diff --git a/bfd/elflink.h b/bfd/elflink.h
index 699b015..62d0c5a 100644
--- a/bfd/elflink.h
+++ b/bfd/elflink.h
@@ -887,14 +887,20 @@ elf_link_add_object_symbols (abfd, info)
library is a function, since common symbols always
represent variables; this can cause confusion in
principle, but any such confusion would seem to indicate
- an erroneous program or shared library. */
+ an erroneous program or shared library. We also treat a
+ common symbol as a definition if the symbol in the shared
+ library is in an uninitialized section, and it has a
+ smaller size. */
if (dynamic && definition)
{
if (h->root.type == bfd_link_hash_defined
|| h->root.type == bfd_link_hash_defweak
|| (h->root.type == bfd_link_hash_common
- && (bind == STB_WEAK
- || ELF_ST_TYPE (sym.st_info) == STT_FUNC)))
+ && ((bind == STB_WEAK
+ || ELF_ST_TYPE (sym.st_info) == STT_FUNC)
+ || ((sec->flags & SEC_ALLOC) != 0
+ && (sec->flags & SEC_LOAD) == 0
+ && sym.st_size < h->size))))
{
override = true;
sec = bfd_und_section_ptr;
@@ -998,15 +1004,11 @@ elf_link_add_object_symbols (abfd, info)
{
if (h->size != 0 && h->size != sym.st_size && ! size_change_ok)
(*_bfd_error_handler)
- ("Warning: size of symbol `%s' was %lu, but in %s is %lu; using %lu",
- name, (unsigned long) h->size,
- bfd_get_filename (abfd), (unsigned long) sym.st_size,
- (h->size < sym.st_size
- ? (unsigned long) sym.st_size
- : (unsigned long) h->size));
-
- if (h->size < sym.st_size)
- h->size = sym.st_size;
+ ("Warning: size of symbol `%s' changed from %lu to %lu in %s",
+ name, (unsigned long) h->size, (unsigned long) sym.st_size,
+ bfd_get_filename (abfd));
+
+ h->size = sym.st_size;
}
if (ELF_ST_TYPE (sym.st_info) != STT_NOTYPE
&& (definition || h->type == STT_NOTYPE))