PowerPC TLS miscounting PLT for __tls_get_addr
authorAlan Modra <amodra@gmail.com>
Mon, 7 Oct 2019 02:51:02 +0000 (13:21 +1030)
committerAlan Modra <amodra@gmail.com>
Tue, 8 Oct 2019 14:06:26 +0000 (00:36 +1030)
commit977424c60ef73b2a051ccb9c1c3dbfedc520b0d9
treed7b2b6036dfe6897a35d007fcc08f03a1cb28d48
parent52b0b563f144da880d90c735912715b8e120706d
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.

(cherry picked from commit 7d04a20ae4af0f1f6e75ec642413c27de4c1e1b8)
bfd/ChangeLog
bfd/elf32-ppc.c
bfd/elf64-ppc.c