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(Buf, 0x3c0f0000); // lui $15, %hi(.got.plt entry) - write32(Buf + 4, 0x8df90000); // l[wd] $25, %lo(.got.plt entry)($15) + write32(Buf + 4, LoadInst); // l[wd] $25, %lo(.got.plt entry)($15) write32(Buf + 8, JrInst); // jr $25 / jr.hb $25 - write32(Buf + 12, 0x25f80000); // addiu $24, $15, %lo(.got.plt entry) + write32(Buf + 12, AddInst); // [d]addiu $24, $15, %lo(.got.plt entry) writeValue(Buf, GotPltEntryAddr + 0x8000, 16, 16); writeValue(Buf + 4, GotPltEntryAddr, 16, 0); writeValue(Buf + 12, GotPltEntryAddr, 16, 0); 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