aboutsummaryrefslogtreecommitdiff
path: root/bfd/elf64-ppc.c
diff options
context:
space:
mode:
Diffstat (limited to 'bfd/elf64-ppc.c')
-rw-r--r--bfd/elf64-ppc.c31
1 files changed, 2 insertions, 29 deletions
diff --git a/bfd/elf64-ppc.c b/bfd/elf64-ppc.c
index 35757b8..e748a41 100644
--- a/bfd/elf64-ppc.c
+++ b/bfd/elf64-ppc.c
@@ -11018,37 +11018,10 @@ ppc64_elf_relocate_section (bfd *output_bfd,
if (tls_mask != 0
&& (tls_mask & TLS_TPREL) == 0)
{
- bfd_vma rtra;
insn = bfd_get_32 (output_bfd, contents + rel->r_offset);
- if ((insn & ((0x3f << 26) | (31 << 11)))
- == ((31 << 26) | (13 << 11)))
- rtra = insn & ((1 << 26) - (1 << 16));
- else if ((insn & ((0x3f << 26) | (31 << 16)))
- == ((31 << 26) | (13 << 16)))
- rtra = (insn & (31 << 21)) | ((insn & (31 << 11)) << 5);
- else
- abort ();
- if ((insn & ((1 << 11) - (1 << 1))) == 266 << 1)
- /* add -> addi. */
- insn = 14 << 26;
- else if ((insn & (31 << 1)) == 23 << 1
- && ((insn & (31 << 6)) < 14 << 6
- || ((insn & (31 << 6)) >= 16 << 6
- && (insn & (31 << 6)) < 24 << 6)))
- /* load and store indexed -> dform. */
- insn = (32 | ((insn >> 6) & 31)) << 26;
- else if ((insn & (31 << 1)) == 21 << 1
- && (insn & (0x1a << 6)) == 0)
- /* ldx, ldux, stdx, stdux -> ld, ldu, std, stdu. */
- insn = (((58 | ((insn >> 6) & 4)) << 26)
- | ((insn >> 6) & 1));
- else if ((insn & (31 << 1)) == 21 << 1
- && (insn & ((1 << 11) - (1 << 1))) == 341 << 1)
- /* lwax -> lwa. */
- insn = (58 << 26) | 2;
- else
+ insn = _bfd_elf_ppc_at_tls_transform (insn, 13);
+ if (insn == 0)
abort ();
- insn |= rtra;
bfd_put_32 (output_bfd, insn, contents + rel->r_offset);
/* Was PPC64_TLS which sits on insn boundary, now
PPC64_TPREL16_LO which is at low-order half-word. */