summaryrefslogtreecommitdiff
path: root/bfd/elfxx-sparc.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@bigpond.net.au>2013-01-31 07:32:44 +0000
committerAlan Modra <amodra@bigpond.net.au>2013-01-31 07:32:44 +0000
commitc90bf3234778074c602f9eae84bb400f9dc3cbf2 (patch)
treef0ed590768430eb96e5fd351c510d49bfb098b46 /bfd/elfxx-sparc.c
parent7b3b2f0134db39759ce35ca4945cc4a006fd9ef1 (diff)
downloadbinutils-redhat-c90bf3234778074c602f9eae84bb400f9dc3cbf2.tar.gz
PR ld/15056
* elfxx-sparc.c (_bfd_sparc_elf_gc_mark_hook): Handle implicit references to __tls_get_addr. * elf32-tilpro.c (tilepro_elf_gc_mark_hook): Likewise. Correct vtinherit and vtentry reloc handling too. * elfxx-tilegx.c (tilegx_elf_gc_mark_hook): As for tilepro.
Diffstat (limited to 'bfd/elfxx-sparc.c')
-rw-r--r--bfd/elfxx-sparc.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/bfd/elfxx-sparc.c b/bfd/elfxx-sparc.c
index 196d566aa9..9684ffd7a4 100644
--- a/bfd/elfxx-sparc.c
+++ b/bfd/elfxx-sparc.c
@@ -1873,6 +1873,29 @@ _bfd_sparc_elf_gc_mark_hook (asection *sec,
return NULL;
}
+ /* FIXME: The test here, in check_relocs and in relocate_section
+ dealing with TLS optimization, ought to be !info->executable. */
+ if (info->shared)
+ {
+ switch (SPARC_ELF_R_TYPE (rel->r_info))
+ {
+ case R_SPARC_TLS_GD_CALL:
+ case R_SPARC_TLS_LDM_CALL:
+ /* This reloc implicitly references __tls_get_addr. We know
+ another reloc will reference the same symbol as the one
+ on this reloc, so the real symbol and section will be
+ gc marked when processing the other reloc. That lets
+ us handle __tls_get_addr here. */
+ h = elf_link_hash_lookup (elf_hash_table (info), "__tls_get_addr",
+ FALSE, FALSE, TRUE);
+ BFD_ASSERT (h != NULL);
+ h->mark = 1;
+ if (h->u.weakdef != NULL)
+ h->u.weakdef->mark = 1;
+ sym = NULL;
+ }
+ }
+
return _bfd_elf_gc_mark_hook (sec, info, rel, h, sym);
}