diff options
author | Ian Lance Taylor <ian@airs.com> | 1997-02-15 00:12:47 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@airs.com> | 1997-02-15 00:12:47 +0000 |
commit | 54626f1aa47e7251e1f966f5e9711ff74379bf6c (patch) | |
tree | e271a106b84e200c6b5676b10a37f2d5a44e221f /bfd/elflink.h | |
parent | f5ed78de1f40836f2e6d8f529107c3620f25ad0c (diff) | |
download | gdb-54626f1aa47e7251e1f966f5e9711ff74379bf6c.zip gdb-54626f1aa47e7251e1f966f5e9711ff74379bf6c.tar.gz gdb-54626f1aa47e7251e1f966f5e9711ff74379bf6c.tar.bz2 |
* elflink.h (elf_link_add_object_symbols): Don't issue a warning
about a symbol defined in a dynamic object if it has already been
defined in a regular object.
Diffstat (limited to 'bfd/elflink.h')
-rw-r--r-- | bfd/elflink.h | 38 |
1 files changed, 34 insertions, 4 deletions
diff --git a/bfd/elflink.h b/bfd/elflink.h index 53362ab..bbd8fb2 100644 --- a/bfd/elflink.h +++ b/bfd/elflink.h @@ -272,6 +272,38 @@ elf_link_add_object_symbols (abfd, info) char *msg; bfd_size_type sz; + name += sizeof ".gnu.warning." - 1; + + /* If this is a shared object, then look up the symbol + in the hash table. If it is there, and it is already + been defined, then we will not be using the entry + from this shared object, so we don't need to warn. + FIXME: If we see the definition in a regular object + later on, we will warn, but we shouldn't. The only + fix is to keep track of what warnings we are supposed + to emit, and then handle them all at the end of the + link. */ + if ((abfd->flags & DYNAMIC) != 0 + && abfd->xvec == info->hash->creator) + { + struct elf_link_hash_entry *h; + + h = elf_link_hash_lookup (elf_hash_table (info), name, + false, false, true); + + /* FIXME: What about bfd_link_hash_common? */ + if (h != NULL + && (h->root.type == bfd_link_hash_defined + || h->root.type == bfd_link_hash_defweak)) + { + /* We don't want to issue this warning. Clobber + the section size so that the warning does not + get copied into the output file. */ + s->_raw_size = 0; + continue; + } + } + sz = bfd_section_size (abfd, s); msg = (char *) bfd_alloc (abfd, sz); if (msg == NULL) @@ -281,10 +313,8 @@ elf_link_add_object_symbols (abfd, info) goto error_return; if (! (_bfd_generic_link_add_one_symbol - (info, abfd, - name + sizeof ".gnu.warning." - 1, - BSF_WARNING, s, (bfd_vma) 0, msg, false, collect, - (struct bfd_link_hash_entry **) NULL))) + (info, abfd, name, BSF_WARNING, s, (bfd_vma) 0, msg, + false, collect, (struct bfd_link_hash_entry **) NULL))) goto error_return; if (! info->relocateable) |