[PATCH] D61586: [mips] fix segment fault for plt on mips64.
Simon Atanasyan via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue May 7 13:25:41 PDT 2019
This revision was not accepted when it landed; it landed in state "Needs Review".
This revision was automatically updated to reflect the committed changes.
Closed by commit rLLD360187: [mips] Fix ld instruction in PLT entries on MIPS64 (authored by atanasyan, committed by ).
Changed prior to commit:
https://reviews.llvm.org/D61586?vs=198384&id=198519#toc
Repository:
rLLD LLVM Linker
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D61586/new/
https://reviews.llvm.org/D61586
Files:
ELF/Arch/Mips.cpp
test/ELF/mips-plt-n64.s
Index: test/ELF/mips-plt-n64.s
===================================================================
--- test/ELF/mips-plt-n64.s
+++ test/ELF/mips-plt-n64.s
@@ -11,7 +11,6 @@
# RUN: ld.lld %t.o %t.so -o %t.exe -z hazardplt
# RUN: llvm-objdump -d %t.exe | FileCheck %s --check-prefixes=CHECK,HAZARDPLT
-
# CHECK: Disassembly of section .text:
# CHECK-EMPTY:
# CHECK-NEXT: __start:
@@ -31,10 +30,10 @@
# HAZARDPLT: 20028: 03 20 fc 09 jalr.hb $25
# CHECK-NEXT: 2002c: 27 18 ff fe addiu $24, $24, -2
# CHECK-NEXT: 20030: 3c 0f 00 03 lui $15, 3
-# CHECK-NEXT: 20034: 8d f9 00 18 lw $25, 24($15)
+# CHECK-NEXT: 20034: dd f9 00 18 ld $25, 24($15)
# DEFAULT: 20038: 03 20 00 08 jr $25
# HAZARDPLT: 20038: 03 20 04 08 jr.hb $25
-# CHECK-NEXT: 2003c: 25 f8 00 18 addiu $24, $15, 24
+# CHECK-NEXT: 2003c: 65 f8 00 18 daddiu $24, $15, 24
.text
.option pic0
Index: ELF/Arch/Mips.cpp
===================================================================
--- ELF/Arch/Mips.cpp
+++ ELF/Arch/Mips.cpp
@@ -327,13 +327,15 @@
return;
}
+ uint32_t LoadInst = ELFT::Is64Bits ? 0xddf90000 : 0x8df90000;
uint32_t JrInst = isMipsR6() ? (Config->ZHazardplt ? 0x03200409 : 0x03200009)
: (Config->ZHazardplt ? 0x03200408 : 0x03200008);
+ uint32_t AddInst = ELFT::Is64Bits ? 0x65f80000 : 0x25f80000;
write32<E>(Buf, 0x3c0f0000); // lui $15, %hi(.got.plt entry)
- write32<E>(Buf + 4, 0x8df90000); // l[wd] $25, %lo(.got.plt entry)($15)
+ write32<E>(Buf + 4, LoadInst); // l[wd] $25, %lo(.got.plt entry)($15)
write32<E>(Buf + 8, JrInst); // jr $25 / jr.hb $25
- write32<E>(Buf + 12, 0x25f80000); // addiu $24, $15, %lo(.got.plt entry)
+ write32<E>(Buf + 12, AddInst); // [d]addiu $24, $15, %lo(.got.plt entry)
writeValue<E>(Buf, GotPltEntryAddr + 0x8000, 16, 16);
writeValue<E>(Buf + 4, GotPltEntryAddr, 16, 0);
writeValue<E>(Buf + 12, GotPltEntryAddr, 16, 0);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D61586.198519.patch
Type: text/x-patch
Size: 2082 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190507/0cf5873f/attachment.bin>
More information about the llvm-commits
mailing list