PR ld/15762
PR ld/12761 * elflink.c (elf_link_add_object_symbols): Correct test in last patch. Remove unnecessary code.
This commit is contained in:
parent
8c058e6af3
commit
db6a5d5f90
2 changed files with 53 additions and 57 deletions
|
@ -1,3 +1,10 @@
|
||||||
|
2013-07-25 Alan Modra <amodra@gmail.com>
|
||||||
|
|
||||||
|
PR ld/15762
|
||||||
|
PR ld/12761
|
||||||
|
* elflink.c (elf_link_add_object_symbols): Correct test in
|
||||||
|
last patch. Remove unnecessary code.
|
||||||
|
|
||||||
2013-07-24 Tristan Gingold <gingold@adacore.com>
|
2013-07-24 Tristan Gingold <gingold@adacore.com>
|
||||||
|
|
||||||
* coff-rs6000.c (xcoff_howto_table): Fix masks and pc_relative for
|
* coff-rs6000.c (xcoff_howto_table): Fix masks and pc_relative for
|
||||||
|
|
103
bfd/elflink.c
103
bfd/elflink.c
|
@ -3344,6 +3344,7 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info)
|
||||||
long old_dynsymcount = 0;
|
long old_dynsymcount = 0;
|
||||||
bfd_size_type old_dynstr_size = 0;
|
bfd_size_type old_dynstr_size = 0;
|
||||||
size_t tabsize = 0;
|
size_t tabsize = 0;
|
||||||
|
asection *s;
|
||||||
|
|
||||||
htab = elf_hash_table (info);
|
htab = elf_hash_table (info);
|
||||||
bed = get_elf_backend_data (abfd);
|
bed = get_elf_backend_data (abfd);
|
||||||
|
@ -3385,75 +3386,64 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info)
|
||||||
symbol. This differs from .gnu.warning sections, which generate
|
symbol. This differs from .gnu.warning sections, which generate
|
||||||
warnings when they are included in an output file. */
|
warnings when they are included in an output file. */
|
||||||
/* PR 12761: Also generate this warning when building shared libraries. */
|
/* PR 12761: Also generate this warning when building shared libraries. */
|
||||||
if (info->executable || info->shared)
|
for (s = abfd->sections; s != NULL; s = s->next)
|
||||||
{
|
{
|
||||||
asection *s;
|
const char *name;
|
||||||
|
|
||||||
for (s = abfd->sections; s != NULL; s = s->next)
|
name = bfd_get_section_name (abfd, s);
|
||||||
|
if (CONST_STRNEQ (name, ".gnu.warning."))
|
||||||
{
|
{
|
||||||
const char *name;
|
char *msg;
|
||||||
|
bfd_size_type sz;
|
||||||
|
|
||||||
name = bfd_get_section_name (abfd, s);
|
name += sizeof ".gnu.warning." - 1;
|
||||||
if (CONST_STRNEQ (name, ".gnu.warning."))
|
|
||||||
|
/* 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 (dynamic)
|
||||||
{
|
{
|
||||||
char *msg;
|
struct elf_link_hash_entry *h;
|
||||||
bfd_size_type sz;
|
|
||||||
|
|
||||||
name += sizeof ".gnu.warning." - 1;
|
h = elf_link_hash_lookup (htab, name, FALSE, FALSE, TRUE);
|
||||||
|
|
||||||
/* If this is a shared object, then look up the symbol
|
/* FIXME: What about bfd_link_hash_common? */
|
||||||
in the hash table. If it is there, and it is already
|
if (h != NULL
|
||||||
been defined, then we will not be using the entry
|
&& (h->root.type == bfd_link_hash_defined
|
||||||
from this shared object, so we don't need to warn.
|
|| h->root.type == bfd_link_hash_defweak))
|
||||||
FIXME: If we see the definition in a regular object
|
continue;
|
||||||
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 (dynamic)
|
|
||||||
{
|
|
||||||
struct elf_link_hash_entry *h;
|
|
||||||
|
|
||||||
h = elf_link_hash_lookup (htab, name, FALSE, FALSE, TRUE);
|
sz = s->size;
|
||||||
|
msg = (char *) bfd_alloc (abfd, sz + 1);
|
||||||
|
if (msg == NULL)
|
||||||
|
goto error_return;
|
||||||
|
|
||||||
/* FIXME: What about bfd_link_hash_common? */
|
if (! bfd_get_section_contents (abfd, s, msg, 0, sz))
|
||||||
if (h != NULL
|
goto error_return;
|
||||||
&& (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->size = 0;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
sz = s->size;
|
msg[sz] = '\0';
|
||||||
msg = (char *) bfd_alloc (abfd, sz + 1);
|
|
||||||
if (msg == NULL)
|
|
||||||
goto error_return;
|
|
||||||
|
|
||||||
if (! bfd_get_section_contents (abfd, s, msg, 0, sz))
|
if (! (_bfd_generic_link_add_one_symbol
|
||||||
goto error_return;
|
(info, abfd, name, BSF_WARNING, s, 0, msg,
|
||||||
|
FALSE, bed->collect, NULL)))
|
||||||
|
goto error_return;
|
||||||
|
|
||||||
msg[sz] = '\0';
|
if (!info->relocatable && info->executable)
|
||||||
|
{
|
||||||
|
/* Clobber the section size so that the warning does
|
||||||
|
not get copied into the output file. */
|
||||||
|
s->size = 0;
|
||||||
|
|
||||||
if (! (_bfd_generic_link_add_one_symbol
|
/* Also set SEC_EXCLUDE, so that symbols defined in
|
||||||
(info, abfd, name, BSF_WARNING, s, 0, msg,
|
the warning section don't get copied to the output. */
|
||||||
FALSE, bed->collect, NULL)))
|
s->flags |= SEC_EXCLUDE;
|
||||||
goto error_return;
|
|
||||||
|
|
||||||
if (!info->relocatable && !info->shared)
|
|
||||||
{
|
|
||||||
/* Clobber the section size so that the warning does
|
|
||||||
not get copied into the output file. */
|
|
||||||
s->size = 0;
|
|
||||||
|
|
||||||
/* Also set SEC_EXCLUDE, so that symbols defined in
|
|
||||||
the warning section don't get copied to the output. */
|
|
||||||
s->flags |= SEC_EXCLUDE;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3479,7 +3469,6 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info)
|
||||||
goto error_return;
|
goto error_return;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
asection *s;
|
|
||||||
const char *soname = NULL;
|
const char *soname = NULL;
|
||||||
char *audit = NULL;
|
char *audit = NULL;
|
||||||
struct bfd_link_needed_list *rpath = NULL, *runpath = NULL;
|
struct bfd_link_needed_list *rpath = NULL, *runpath = NULL;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue