]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
PR32387 ppc64 TLS optimization bug with -fno-plt code
authorAlan Modra <amodra@gmail.com>
Mon, 25 Nov 2024 21:54:19 +0000 (08:24 +1030)
committerAlan Modra <amodra@gmail.com>
Wed, 27 Nov 2024 10:24:25 +0000 (20:54 +1030)
commit46873460b6aa66726095ea86fb612fb6ac0a2ebc
tree43c2f9d0170580ed24f0798481a882d80da7886a
parent2a0332b1d21b58325d24c33abcecf5f84c01bdc5
PR32387 ppc64 TLS optimization bug with -fno-plt code

The inline plt code emitted by gcc is incompatible with the
linker/ld.so --tls-get-addr-optimize scheme.  This is the runtime
optimisation where the first call to __tls_get_addr results in
__tls_get_addr updating the tls_index pair, then the special linker
stub using that to short-circuit second and subsequent calls for a
given tls symbol.  Enabled by default when the linker sees
__tls_get_addr_opt is preseent, and enabled in ld.so when DT_PPC64_OPT
has PPC64_OPT_TLS set.  Note that this is distinct from link-time tls
optimisation.

PR 32387
* elf64-ppc.c (ppc64_elf_check_relocs): Disable tls_get_addr_opt
on detecting inline plt calls to __tls_get_addr.

(cherry picked from commit 1686dc7079f1c03bdaffd2f779b92aa2b7ad97b5)
bfd/elf64-ppc.c