aboutsummaryrefslogtreecommitdiff
path: root/bfd/elf64-ppc.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2017-11-04 13:41:29 +1030
committerAlan Modra <amodra@gmail.com>2017-11-05 09:37:33 +1030
commitf15d0b545b9e9dada8d1398163693f67792e9e79 (patch)
treee5d754764e1f0a3e6139d8f2a3d9a72273170ccf /bfd/elf64-ppc.c
parent98bbb1b86180324b278842d8d73c79cb5d76d349 (diff)
downloadgdb-f15d0b545b9e9dada8d1398163693f67792e9e79.zip
gdb-f15d0b545b9e9dada8d1398163693f67792e9e79.tar.gz
gdb-f15d0b545b9e9dada8d1398163693f67792e9e79.tar.bz2
powerpc TLS in PIEs
This patch removes unnecessary GOT IE TLS relocations in PIEs. Useful with --no-tls-optimize, or with an enormous TLS segment. With the default --tls-optimize in effect IE code sequences will be edited to LE under the same circumstances we can remove the GOT reloc. * elf32-ppc.c (got_entries_needed, got_relocs_needed): New functions. (allocate_dynrelocs, ppc_elf_size_dynamic_sections): Use them here. (ppc_elf_relocate_section): Don't output a dynamic relocation for IE GOT entries in an executable. * elf64-ppc.c (allocate_got): Trim unnecessary TPREL relocs. (ppc64_elf_size_dynamic_sections): Likewise. (ppc64_elf_relocate_section): Likewise.
Diffstat (limited to 'bfd/elf64-ppc.c')
-rw-r--r--bfd/elf64-ppc.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/bfd/elf64-ppc.c b/bfd/elf64-ppc.c
index bd42af0..31cb2f2 100644
--- a/bfd/elf64-ppc.c
+++ b/bfd/elf64-ppc.c
@@ -9584,7 +9584,10 @@ allocate_got (struct elf_link_hash_entry *h,
htab->elf.irelplt->size += rentsize;
htab->got_reli_size += rentsize;
}
- else if ((bfd_link_pic (info)
+ else if (((bfd_link_pic (info)
+ && !((gent->tls_type & TLS_TPREL) != 0
+ && bfd_link_executable (info)
+ && SYMBOL_REFERENCES_LOCAL (info, h)))
|| (htab->elf.dynamic_sections_created
&& h->dynindx != -1
&& !SYMBOL_REFERENCES_LOCAL (info, h)))
@@ -10072,7 +10075,9 @@ ppc64_elf_size_dynamic_sections (bfd *output_bfd,
htab->elf.irelplt->size += rel_size;
htab->got_reli_size += rel_size;
}
- else if (bfd_link_pic (info))
+ else if (bfd_link_pic (info)
+ && !((ent->tls_type & TLS_TPREL) != 0
+ && bfd_link_executable (info)))
{
asection *srel = ppc64_elf_tdata (ibfd)->relgot;
srel->size += rel_size;
@@ -14514,7 +14519,10 @@ ppc64_elf_relocate_section (bfd *output_bfd,
&& (h == NULL
|| !UNDEFWEAK_NO_DYNAMIC_RELOC (info, &h->elf)
|| (tls_type == (TLS_TLS | TLS_LD)
- && !h->elf.def_dynamic))))
+ && !h->elf.def_dynamic))
+ && !(tls_type == (TLS_TLS | TLS_TPREL)
+ && bfd_link_executable (info)
+ && SYMBOL_REFERENCES_LOCAL (info, &h->elf))))
relgot = ppc64_elf_tdata (ent->owner)->relgot;
if (relgot != NULL)
{