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

Qiao Pengcheng via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 6 02:07:27 PDT 2019


QiaoPengcheng added a comment.

while using   clang+lld+flto  compiling  on mips64-linux platform,
the compiling is ok, but generating mips64-assemble-code is wrong wthin @plt,
If runnging the mips64-elf executable file will emit a segment fault   because the codes within  section of .plt  are not for mips64.

for example,
Dump of assembler code for function __cxa_atexit at plt:

  0x0000000000e11d20 <+0>: lui t3,0x189
  0x0000000000e11d24 <+4>:** lw  t9,-31944(t3)**
  0x0000000000e11d28 <+8>: jr  t9  
  0x0000000000e11d2c <+12>:  **  addiu  t8,t3,-31944**

End of assembler dump.
Dump of assembler code for function clock_gettime at plt:

  0x0000000000e11d30 <+0>: lui t3,0x189
  0x0000000000e11d34 <+4>:** lw  t9,-31936(t3)**
  0x0000000000e11d38 <+8>: jr  t9  
  0x0000000000e11d3c <+12>:    **addiu  t8,t3,-31936**

End of assembler dump.

The correct codes are:
Dump of assembler code for function __cxa_atexit at plt:

  0x0000000000e11d20 <+0>: lui t3,0x189
  0x0000000000e11d24 <+4>: ld  t9,-31944(t3)
  0x0000000000e11d28 <+8>: jr  t9  
  0x0000000000e11d2c <+12>:    daddiu  t8,t3,-31944

End of assembler dump.
Dump of assembler code for function clock_gettime at plt:

  0x0000000000e11d30 <+0>: lui t3,0x189
  0x0000000000e11d34 <+4>: ld  t9,-31936(t3)
  0x0000000000e11d38 <+8>: jr  t9  
  0x0000000000e11d3c <+12>:    daddiu  t8,t3,-31936

End of assembler dump.


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