* elflink.h (elf_link_add_object_symbols): Don't warn about

changing the size or type if the old definition was weak.
This commit is contained in:
Ian Lance Taylor 1995-10-10 05:30:17 +00:00
parent 5caef232bd
commit 8235c11240
2 changed files with 14 additions and 2 deletions

View File

@ -1,3 +1,8 @@
Tue Oct 10 01:28:29 1995 Ian Lance Taylor <ian@cygnus.com>
* elflink.h (elf_link_add_object_symbols): Don't warn about
changing the size or type if the old definition was weak.
Mon Oct 9 11:24:08 1995 Ian Lance Taylor <ian@cygnus.com> Mon Oct 9 11:24:08 1995 Ian Lance Taylor <ian@cygnus.com>
* coffcode.h (combined_entry_type): Add fix_line field. * coffcode.h (combined_entry_type): Add fix_line field.

View File

@ -555,6 +555,7 @@ elf_link_add_object_symbols (abfd, info)
const char *name; const char *name;
struct elf_link_hash_entry *h; struct elf_link_hash_entry *h;
boolean definition; boolean definition;
boolean wasweak;
boolean new_weakdef; boolean new_weakdef;
elf_swap_symbol_in (abfd, esym, &sym); elf_swap_symbol_in (abfd, esym, &sym);
@ -641,6 +642,7 @@ elf_link_add_object_symbols (abfd, info)
else else
definition = true; definition = true;
wasweak = false;
if (info->hash->creator->flavour == bfd_target_elf_flavour) if (info->hash->creator->flavour == bfd_target_elf_flavour)
{ {
/* We need to look up the symbol now in order to get some of /* We need to look up the symbol now in order to get some of
@ -657,6 +659,10 @@ elf_link_add_object_symbols (abfd, info)
|| h->root.type == bfd_link_hash_warning) || h->root.type == bfd_link_hash_warning)
h = (struct elf_link_hash_entry *) h->root.u.i.link; 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);
/* If we are looking at a dynamic object, and this is a /* If we are looking at a dynamic object, and this is a
definition, we need to see if it has already been defined definition, we need to see if it has already been defined
by some other object. If it has, we want to use the by some other object. If it has, we want to use the
@ -750,7 +756,7 @@ elf_link_add_object_symbols (abfd, info)
if (sym.st_size != 0 if (sym.st_size != 0
&& (definition || h->size == 0)) && (definition || h->size == 0))
{ {
if (h->size != 0 && h->size != sym.st_size) if (h->size != 0 && h->size != sym.st_size && ! wasweak)
(*_bfd_error_handler) (*_bfd_error_handler)
("Warning: size of symbol `%s' changed from %lu to %lu in %s", ("Warning: size of symbol `%s' changed from %lu to %lu in %s",
name, (unsigned long) h->size, (unsigned long) sym.st_size, name, (unsigned long) h->size, (unsigned long) sym.st_size,
@ -762,7 +768,8 @@ elf_link_add_object_symbols (abfd, info)
&& (definition || h->type == STT_NOTYPE)) && (definition || h->type == STT_NOTYPE))
{ {
if (h->type != STT_NOTYPE if (h->type != STT_NOTYPE
&& h->type != ELF_ST_TYPE (sym.st_info)) && h->type != ELF_ST_TYPE (sym.st_info)
&& ! wasweak)
(*_bfd_error_handler) (*_bfd_error_handler)
("Warning: type of symbol `%s' changed from %d to %d in %s", ("Warning: type of symbol `%s' changed from %d to %d in %s",
name, h->type, ELF_ST_TYPE (sym.st_info), name, h->type, ELF_ST_TYPE (sym.st_info),