aboutsummaryrefslogtreecommitdiff
path: root/bfd/elf64-ppc.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2019-10-07 13:21:02 +1030
committerAlan Modra <amodra@gmail.com>2019-10-07 13:21:02 +1030
commit7d04a20ae4af0f1f6e75ec642413c27de4c1e1b8 (patch)
treef17459048cae52e21ecff5f83390ce9971b901ae /bfd/elf64-ppc.c
parent9737e8af48e257f24e860fbf36af8c314e73076a (diff)
downloadgdb-7d04a20ae4af0f1f6e75ec642413c27de4c1e1b8.zip
gdb-7d04a20ae4af0f1f6e75ec642413c27de4c1e1b8.tar.gz
gdb-7d04a20ae4af0f1f6e75ec642413c27de4c1e1b8.tar.bz2
PowerPC TLS miscounting PLT for __tls_get_addr
ppc*_elf_tls_optimize decrements the PLT refcount for __tls_get_addr when a GD or LD sequence can be optimized. Without tls marker relocs this must be done when processing the argument setup relocations. With marker relocs it's better done when processing the marker reloc. But don't count them both ways. Seen as "unresolvable R_PPC_REL24 relocation against symbol `__tls_get_addr_opt'" (and other branch relocs). * elf32-ppc.c (ppc_elf_tls_optimize): Don't process R_PPC_TLSLD with non-local symbol. Don't double count __tls_get_addr calls with marker relocs. * elf64-ppc.c (ppc64_elf_tls_optimize): Likewise.
Diffstat (limited to 'bfd/elf64-ppc.c')
-rw-r--r--bfd/elf64-ppc.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/bfd/elf64-ppc.c b/bfd/elf64-ppc.c
index 31c86b4..842fc40 100644
--- a/bfd/elf64-ppc.c
+++ b/bfd/elf64-ppc.c
@@ -7906,8 +7906,11 @@ ppc64_elf_tls_optimize (struct bfd_link_info *info)
}
continue;
- case R_PPC64_TLSGD:
case R_PPC64_TLSLD:
+ if (!is_local)
+ continue;
+ /* Fall through. */
+ case R_PPC64_TLSGD:
if (rel + 1 < relend
&& is_plt_seq_reloc (ELF64_R_TYPE (rel[1].r_info)))
{
@@ -8092,7 +8095,7 @@ ppc64_elf_tls_optimize (struct bfd_link_info *info)
!= (TLS_TLS | TLS_MARK)))
continue;
- if (expecting_tls_get_addr)
+ if (expecting_tls_get_addr == 1 + !sec->nomark_tls_get_addr)
{
struct plt_entry *ent = NULL;