[PATCH] D54154: [ELF][MIPS] Use MIPS R6 `sigrie` as a trap instruction

James Clarke via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 14 15:56:14 PST 2018


jrtc27 added inline comments.


================
Comment at: ELF/Arch/Mips.cpp:61
+  // Set `sigrie 1` as a trap instruction.
+  write32(TrapInstr.data(), 0x04170001);
 
----------------
ruiu wrote:
> Let's not handle four byte sequence as one integer because it is very confusing. I'd write
> 
>   if (Config->IsLE)
>     TrapInstr = {....};
>   else
>     TrapInstr = {....};
To me this actually seems the most sensible way of writing it; you don't have to care about endianness, and just write the instruction as a literal integer. This is exactly like how you write the PLT entry on various architectures, and both are writing instructions to byte arrays.


Repository:
  rLLD LLVM Linker

https://reviews.llvm.org/D54154





More information about the llvm-commits mailing list