[ELF][MIPS] Use MIPS R6 `sigrie` as a trap instruction
authorSimon Atanasyan <simon@atanasyan.com>
Fri, 16 Nov 2018 05:30:47 +0000 (05:30 +0000)
committerSimon Atanasyan <simon@atanasyan.com>
Fri, 16 Nov 2018 05:30:47 +0000 (05:30 +0000)
commit275a5b442b1de63502641ffcec65eb983ffc8233
treeaab616c87dc20b0346d1cdb7dcaf9b000a5d48fb
parenteabb8dd01547c6fcccb7dcbba7a4a3b8ba67694c
[ELF][MIPS] Use MIPS R6 `sigrie` as a trap instruction

Current value using as a trap instruction (0xefefefef) is not a good choice
for MIPS because it's a valid MIPS instruction `swc3 $15,-4113(ra)`. This
patch replaces 0xefefefef by 0x04170001. For all MIPS ISA revisions before
R6, this value is just invalid instruction. Starting from MIPS R6 it's
a valid instruction `sigrie 1` which signals a Reserved Instruction exception.

mips-traps.s test case is added to test trap encoding. Other test cases
are modified to remove redundant checking.

Differential revision: https://reviews.llvm.org/D54154

llvm-svn: 347029
lld/ELF/Arch/Mips.cpp
lld/test/ELF/mips-got16-relocatable.s
lld/test/ELF/mips-npic-call-pic-os.s
lld/test/ELF/mips-npic-call-pic-script.s
lld/test/ELF/mips-npic-call-pic.s
lld/test/ELF/mips-traps.s [new file with mode: 0644]