diff options
author | Alan Modra <amodra@gmail.com> | 2018-12-31 12:11:42 +1030 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2018-12-31 12:12:38 +1030 |
commit | c96e057398b599a343cdff68325251346b71594e (patch) | |
tree | d1eb02d6fafb827cebce39da7764d6279b26393d /bfd | |
parent | 17c885c61819650bc00790988e46d3d1d8801691 (diff) | |
download | gdb-c96e057398b599a343cdff68325251346b71594e.zip gdb-c96e057398b599a343cdff68325251346b71594e.tar.gz gdb-c96e057398b599a343cdff68325251346b71594e.tar.bz2 |
[PowerPC64] Nop out ld 2,24(1) after old-style __tls_get_addr
When optimising inline plt calls to __tls_get_addr without tls marker
relocs, ld should zap any toc restore insn after the bctrl, to stop a
load-hit-store stall.
* elf64-ppc.c (ppc64_elf_relocate_section <tls_ldgd_opt>): When
editing an old-style __tls_get_addr call, replace a toc restore
insn with a nop.
Diffstat (limited to 'bfd')
-rw-r--r-- | bfd/ChangeLog | 6 | ||||
-rw-r--r-- | bfd/elf64-ppc.c | 10 |
2 files changed, 15 insertions, 1 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 1396c70..fbdd0c2 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,9 @@ +2018-12-31 Alan Modra <amodra@gmail.com> + + * elf64-ppc.c (ppc64_elf_relocate_section <tls_ldgd_opt>): When + editing an old-style __tls_get_addr call, replace a toc restore + insn with a nop. + 2018-12-28 Alan Modra <amodra@gmail.com> PR 24015 diff --git a/bfd/elf64-ppc.c b/bfd/elf64-ppc.c index 2f4cfaa..e42cefc 100644 --- a/bfd/elf64-ppc.c +++ b/bfd/elf64-ppc.c @@ -13841,7 +13841,15 @@ ppc64_elf_relocate_section (bfd *output_bfd, bfd_put_32 (input_bfd, insn1, contents + rel->r_offset - d_offset); if (offset != (bfd_vma) -1) - bfd_put_32 (input_bfd, insn2, contents + offset); + { + bfd_put_32 (input_bfd, insn2, contents + offset); + if (offset + 8 <= input_section->size) + { + insn2 = bfd_get_32 (input_bfd, contents + offset + 4); + if (insn2 == LD_R2_0R1 + STK_TOC (htab)) + bfd_put_32 (input_bfd, NOP, contents + offset + 4); + } + } if ((tls_mask & tls_gd) == 0 && (tls_gd == 0 || toc_symndx != 0)) { |