* elfxx-sparc.c (_bfd_sparc_elf_check_relocs): When STT_GNU_IFUNC and

h->def_regular, set h->ref_regular.
	(allocate_dynrelocs): Only force output of STT_GNU_IFUNC plt entries
	and dynamic relocations if h->ref_regular.
This commit is contained in:
David S. Miller 2010-03-02 01:46:09 +00:00
parent 948ad63d08
commit b48ca1d492
2 changed files with 15 additions and 3 deletions

View file

@ -1,3 +1,10 @@
2010-03-01 David S. Miller <davem@davemloft.net>
* elfxx-sparc.c (_bfd_sparc_elf_check_relocs): When STT_GNU_IFUNC and
h->def_regular, set h->ref_regular.
(allocate_dynrelocs): Only force output of STT_GNU_IFUNC plt entries
and dynamic relocations if h->ref_regular.
2010-02-25 Alan Modra <amodra@gmail.com> 2010-02-25 Alan Modra <amodra@gmail.com>
PR ld/11304 PR ld/11304

View file

@ -1277,8 +1277,11 @@ _bfd_sparc_elf_check_relocs (bfd *abfd, struct bfd_link_info *info,
if (h && h->type == STT_GNU_IFUNC) if (h && h->type == STT_GNU_IFUNC)
{ {
if (h->def_regular) if (h->def_regular)
{
h->ref_regular = 1;
h->plt.refcount += 1; h->plt.refcount += 1;
} }
}
/* Compatibility with old R_SPARC_REV32 reloc conflicting /* Compatibility with old R_SPARC_REV32 reloc conflicting
with R_SPARC_TLS_GD_HI22. */ with R_SPARC_TLS_GD_HI22. */
@ -2022,7 +2025,8 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, PTR inf)
if ((htab->elf.dynamic_sections_created if ((htab->elf.dynamic_sections_created
&& h->plt.refcount > 0) && h->plt.refcount > 0)
|| (h->type == STT_GNU_IFUNC || (h->type == STT_GNU_IFUNC
&& h->def_regular)) && h->def_regular
&& h->ref_regular))
{ {
/* Make sure this symbol is output as a dynamic symbol. /* Make sure this symbol is output as a dynamic symbol.
Undefined weak syms won't yet be marked as dynamic. */ Undefined weak syms won't yet be marked as dynamic. */
@ -2034,7 +2038,8 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, PTR inf)
} }
if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (1, info->shared, h) if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (1, info->shared, h)
|| h->type == STT_GNU_IFUNC) || (h->type == STT_GNU_IFUNC
&& h->def_regular))
{ {
asection *s = htab->elf.splt; asection *s = htab->elf.splt;