aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@airs.com>1995-10-11 04:50:20 +0000
committerIan Lance Taylor <ian@airs.com>1995-10-11 04:50:20 +0000
commitee9f09cd2624af3cccfd08955c8aba7ede3b1c95 (patch)
tree4550823d525c22c8c221a4bbdbca74bf52edbd89 /bfd
parent78b31b6bb87a86de828c093235f3709ac8f06fa3 (diff)
downloadgdb-ee9f09cd2624af3cccfd08955c8aba7ede3b1c95.zip
gdb-ee9f09cd2624af3cccfd08955c8aba7ede3b1c95.tar.gz
gdb-ee9f09cd2624af3cccfd08955c8aba7ede3b1c95.tar.bz2
* elflink.h (elf_link_add_object_symbols): Correct conditions
under which type and size change warnings are issued.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/ChangeLog5
-rw-r--r--bfd/elflink.h25
2 files changed, 23 insertions, 7 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 18f401a..5d3787c 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,8 @@
+Wed Oct 11 00:49:29 1995 Ian Lance Taylor <ian@cygnus.com>
+
+ * elflink.h (elf_link_add_object_symbols): Correct conditions
+ under which type and size change warnings are issued.
+
Tue Oct 10 18:32:46 1995 Ian Lance Taylor <ian@cygnus.com>
* coffgen.c (coff_count_linenumbers): Don't count line numbers for
diff --git a/bfd/elflink.h b/bfd/elflink.h
index dc2da5e..86328d6 100644
--- a/bfd/elflink.h
+++ b/bfd/elflink.h
@@ -555,7 +555,7 @@ elf_link_add_object_symbols (abfd, info)
const char *name;
struct elf_link_hash_entry *h;
boolean definition;
- boolean wasweak;
+ boolean size_change_ok, type_change_ok;
boolean new_weakdef;
elf_swap_symbol_in (abfd, esym, &sym);
@@ -642,7 +642,8 @@ elf_link_add_object_symbols (abfd, info)
else
definition = true;
- wasweak = false;
+ size_change_ok = false;
+ type_change_ok = false;
if (info->hash->creator->flavour == bfd_target_elf_flavour)
{
/* We need to look up the symbol now in order to get some of
@@ -659,9 +660,17 @@ elf_link_add_object_symbols (abfd, info)
|| h->root.type == bfd_link_hash_warning)
h = (struct elf_link_hash_entry *) h->root.u.i.link;
- /* Remember whether this used to be a weak definition. */
- wasweak = (h->root.type == bfd_link_hash_defweak
- || h->root.type == bfd_link_hash_undefweak);
+ /* It's OK to change the type if it used to be a weak
+ definition. */
+ type_change_ok = (h->root.type == bfd_link_hash_defweak
+ || h->root.type == bfd_link_hash_undefweak);
+
+ /* It's OK to change the size if it used to be a weak
+ definition, or if it used to be undefined, or if we will
+ be overriding an old definition.
+ */
+ size_change_ok = (type_change_ok
+ || h->root.type == bfd_link_hash_undefined);
/* If we are looking at a dynamic object, and this is a
definition, we need to see if it has already been defined
@@ -678,6 +687,7 @@ elf_link_add_object_symbols (abfd, info)
{
sec = bfd_und_section_ptr;
definition = false;
+ size_change_ok = true;
}
}
@@ -702,6 +712,7 @@ elf_link_add_object_symbols (abfd, info)
with the new definition. */
h->root.type = bfd_link_hash_undefined;
h->root.u.undef.abfd = h->root.u.def.section->owner;
+ size_change_ok = true;
}
}
@@ -756,7 +767,7 @@ elf_link_add_object_symbols (abfd, info)
if (sym.st_size != 0
&& (definition || h->size == 0))
{
- if (h->size != 0 && h->size != sym.st_size && ! wasweak)
+ if (h->size != 0 && h->size != sym.st_size && ! size_change_ok)
(*_bfd_error_handler)
("Warning: size of symbol `%s' changed from %lu to %lu in %s",
name, (unsigned long) h->size, (unsigned long) sym.st_size,
@@ -769,7 +780,7 @@ elf_link_add_object_symbols (abfd, info)
{
if (h->type != STT_NOTYPE
&& h->type != ELF_ST_TYPE (sym.st_info)
- && ! wasweak)
+ && ! type_change_ok)
(*_bfd_error_handler)
("Warning: type of symbol `%s' changed from %d to %d in %s",
name, h->type, ELF_ST_TYPE (sym.st_info),