[PATCH] D61586: [mips] fix segment fault for plt on mips64.

Simon Atanasyan via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 6 03:45:25 PDT 2019


atanasyan added a comment.

Good catch, thanks. BTW on what OS do you get this problem? PLT records on MIPS 64-bit code are not widely used.

Please add test case for the patch. Probably we can split the `lld/test/ELF/mips-26-n32-n64.s` into N32 and N64 variants.



================
Comment at: lld/ELF/Arch/Mips.cpp:334
   write32<E>(Buf, 0x3c0f0000);     // lui   $15, %hi(.got.plt entry)
-  write32<E>(Buf + 4, 0x8df90000); // l[wd] $25, %lo(.got.plt entry)($15)
+  if (ELFT::Is64Bits) {
+    write32<E>(Buf + 4, 0xddf90000); // ld $25, %lo(.got.plt entry)($15)
----------------
Remove curly brackets for this branch or add them for both ones.


================
Comment at: lld/ELF/Arch/Mips.cpp:339
   write32<E>(Buf + 8, JrInst);     // jr  $25 / jr.hb $25
-  write32<E>(Buf + 12, 0x25f80000); // addiu $24, $15, %lo(.got.plt entry)
+  if (ELFT::Is64Bits) {
+    write32<E>(Buf + 12, 0x65f80000); // daddiu $24, $15, %lo(.got.plt entry)
----------------
Ditto


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D61586/new/

https://reviews.llvm.org/D61586





More information about the llvm-commits mailing list