[lld] r250230 - [ELF2/PPC64] Fix the TOC save in the .plt stub

Hal Finkel via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 13 14:47:34 PDT 2015


Author: hfinkel
Date: Tue Oct 13 16:47:34 2015
New Revision: 250230

URL: http://llvm.org/viewvc/llvm-project?rev=250230&view=rev
Log:
[ELF2/PPC64] Fix the TOC save in the .plt stub

The comment was right, but the encoding was wrong (and, it seems, I forgot a
test case for the .plt stub).

Modified:
    lld/trunk/ELF/Target.cpp
    lld/trunk/test/elf2/ppc64-toc-restore.s

Modified: lld/trunk/ELF/Target.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Target.cpp?rev=250230&r1=250229&r2=250230&view=diff
==============================================================================
--- lld/trunk/ELF/Target.cpp (original)
+++ lld/trunk/ELF/Target.cpp Tue Oct 13 16:47:34 2015
@@ -271,7 +271,7 @@ void PPC64TargetInfo::writePltEntry(uint
   // be a pointer to the function descriptor in the .opd section. Using
   // this scheme is simpler, but requires an extra indirection per PLT dispatch.
 
-  write32be(Buf,      0xf8410000);                   // std %r2, 40(%r1)
+  write32be(Buf,      0xf8410028);                   // std %r2, 40(%r1)
   write32be(Buf + 4,  0x3d620000 | applyPPCHa(Off)); // addis %r11, %r2, X at ha
   write32be(Buf + 8,  0xe98b0000 | applyPPCLo(Off)); // ld %r12, X at l(%r11)
   write32be(Buf + 12, 0xe96c0000);                   // ld %r11,0(%r12)

Modified: lld/trunk/test/elf2/ppc64-toc-restore.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf2/ppc64-toc-restore.s?rev=250230&r1=250229&r2=250230&view=diff
==============================================================================
--- lld/trunk/test/elf2/ppc64-toc-restore.s (original)
+++ lld/trunk/test/elf2/ppc64-toc-restore.s Tue Oct 13 16:47:34 2015
@@ -52,4 +52,11 @@ last:
 
 // CHECK: Disassembly of section .plt:
 // CHECK: .plt:
-// CHECK: 20020:
+// CHECK: 20020:       f8 41 00 28     std 2, 40(1)
+// CHECK: 20024:       3d 62 00 00     addis 11, 2, 0
+// CHECK: 20028:       e9 8b 80 00     ld 12, -32768(11)
+// CHECK: 2002c:       e9 6c 00 00     ld 11, 0(12)
+// CHECK: 20030:       7d 69 03 a6     mtctr 11
+// CHECK: 20034:       e8 4c 00 08     ld 2, 8(12)
+// CHECK: 20038:       e9 6c 00 10     ld 11, 16(12)
+// CHECK: 2003c:       4e 80 04 20     bctr




More information about the llvm-commits mailing list