Index: ELF/Arch/Mips.cpp =================================================================== --- ELF/Arch/Mips.cpp +++ ELF/Arch/Mips.cpp @@ -56,7 +56,9 @@ NoneRel = R_MIPS_NONE; PltRel = R_MIPS_JUMP_SLOT; NeedsThunks = true; - TrapInstr = {0xef, 0xef, 0xef, 0xef}; + + // Set `sigrie 1` as a trap instruction. + write32(TrapInstr.data(), 0x04170001); if (ELFT::Is64Bits) { RelativeRel = (R_MIPS_64 << 8) | R_MIPS_REL32; Index: test/ELF/mips-got16-relocatable.s =================================================================== --- test/ELF/mips-got16-relocatable.s +++ test/ELF/mips-got16-relocatable.s @@ -14,9 +14,7 @@ # OBJ-NEXT: 00000000: R_MIPS_GOT16 .data # OBJ-NEXT: 4: 27 24 00 00 addiu $4, $25, 0 # OBJ-NEXT: 00000004: R_MIPS_LO16 .data -# OBJ-NEXT: 8: ef ef ef ef <unknown> -# OBJ-NEXT: c: ef ef ef ef <unknown> -# OBJ-NEXT: 10: 8f 99 00 00 lw $25, 0($gp) +# OBJ: 10: 8f 99 00 00 lw $25, 0($gp) # OBJ-NEXT: 00000010: R_MIPS_GOT16 .data # OBJ-NEXT: 14: 27 24 00 10 addiu $4, $25, 16 # OBJ-NEXT: 00000014: R_MIPS_LO16 .data @@ -25,9 +23,7 @@ # SO-NEXT: .text: # SO-NEXT: 10000: 8f 99 80 18 lw $25, -32744($gp) # SO-NEXT: 10004: 27 24 00 00 addiu $4, $25, 0 -# SO-NEXT: 10008: ef ef ef ef <unknown> -# SO-NEXT: 1000c: ef ef ef ef <unknown> -# SO-NEXT: 10010: 8f 99 80 18 lw $25, -32744($gp) +# SO: 10010: 8f 99 80 18 lw $25, -32744($gp) # SO-NEXT: 10014: 27 24 00 10 addiu $4, $25, 16 .text Index: test/ELF/mips-npic-call-pic-os.s =================================================================== --- test/ELF/mips-npic-call-pic-os.s +++ test/ELF/mips-npic-call-pic-os.s @@ -19,37 +19,37 @@ # CHECK-NEXT: 20004: 08 00 80 08 j 131104 <foo1a> # CHECK-NEXT: 20008: 27 39 00 20 addiu $25, $25, 32 # CHECK-NEXT: 2000c: 00 00 00 00 nop + # CHECK: __LA25Thunk_foo1b: # CHECK-NEXT: 20010: 3c 19 00 02 lui $25, 2 # CHECK-NEXT: 20014: 08 00 80 09 j 131108 <foo1b> # CHECK-NEXT: 20018: 27 39 00 24 addiu $25, $25, 36 # CHECK-NEXT: 2001c: 00 00 00 00 nop + # CHECK: foo1a: # CHECK-NEXT: 20020: 00 00 00 00 nop + # CHECK: foo1b: # CHECK-NEXT: 20024: 00 00 00 00 nop + # CHECK: __LA25Thunk_foo2: # CHECK-NEXT: 20028: 3c 19 00 02 lui $25, 2 # CHECK-NEXT: 2002c: 08 00 80 10 j 131136 <foo2> # CHECK-NEXT: 20030: 27 39 00 40 addiu $25, $25, 64 # CHECK-NEXT: 20034: 00 00 00 00 nop -# CHECK-NEXT: 20038: ef ef ef ef <unknown> -# CHECK-NEXT: 2003c: ef ef ef ef <unknown> + # CHECK: foo2: # CHECK-NEXT: 20040: 00 00 00 00 nop + # CHECK: __LA25Thunk_fpic: # CHECK-NEXT: 20044: 3c 19 00 02 lui $25, 2 # CHECK-NEXT: 20048: 08 00 80 18 j 131168 <fpic> # CHECK-NEXT: 2004c: 27 39 00 60 addiu $25, $25, 96 # CHECK-NEXT: 20050: 00 00 00 00 nop -# CHECK-NEXT: 20054: ef ef ef ef <unknown> -# CHECK-NEXT: 20058: ef ef ef ef <unknown> -# CHECK-NEXT: 2005c: ef ef ef ef <unknown> + # CHECK: fpic: # CHECK-NEXT: 20060: 00 00 00 00 nop -# CHECK-NEXT: 20064: ef ef ef ef <unknown> -# CHECK-NEXT: 20068: ef ef ef ef <unknown> -# CHECK-NEXT: 2006c: ef ef ef ef <unknown> + # CHECK: fnpic: # CHECK-NEXT: 20070: 00 00 00 00 nop # CHECK-NEXT: Disassembly of section differentos: @@ -79,40 +79,41 @@ # REVERSE-NEXT: 20004: 08 00 80 08 j 131104 <foo1a> # REVERSE-NEXT: 20008: 27 39 00 20 addiu $25, $25, 32 # REVERSE-NEXT: 2000c: 00 00 00 00 nop + # REVERSE: __LA25Thunk_foo1b: # REVERSE-NEXT: 20010: 3c 19 00 02 lui $25, 2 # REVERSE-NEXT: 20014: 08 00 80 09 j 131108 <foo1b> # REVERSE-NEXT: 20018: 27 39 00 24 addiu $25, $25, 36 # REVERSE-NEXT: 2001c: 00 00 00 00 nop + # REVERSE: foo1a: # REVERSE-NEXT: 20020: 00 00 00 00 nop + # REVERSE: foo1b: # REVERSE-NEXT: 20024: 00 00 00 00 nop + # REVERSE: __LA25Thunk_foo2: # REVERSE-NEXT: 20028: 3c 19 00 02 lui $25, 2 # REVERSE-NEXT: 2002c: 08 00 80 10 j 131136 <foo2> # REVERSE-NEXT: 20030: 27 39 00 40 addiu $25, $25, 64 # REVERSE-NEXT: 20034: 00 00 00 00 nop -# REVERSE-NEXT: 20038: ef ef ef ef <unknown> -# REVERSE-NEXT: 2003c: ef ef ef ef <unknown> + # REVERSE: foo2: # REVERSE-NEXT: 20040: 00 00 00 00 nop -# REVERSE-NEXT: 20044: ef ef ef ef <unknown> -# REVERSE-NEXT: 20048: ef ef ef ef <unknown> -# REVERSE-NEXT: 2004c: ef ef ef ef <unknown> + # REVERSE: __LA25Thunk_fpic: # REVERSE-NEXT: 20050: 3c 19 00 02 lui $25, 2 # REVERSE-NEXT: 20054: 08 00 80 18 j 131168 <fpic> # REVERSE-NEXT: 20058: 27 39 00 60 addiu $25, $25, 96 # REVERSE-NEXT: 2005c: 00 00 00 00 nop + # REVERSE: fpic: # REVERSE-NEXT: 20060: 00 00 00 00 nop -# REVERSE-NEXT: 20064: ef ef ef ef <unknown> -# REVERSE-NEXT: 20068: ef ef ef ef <unknown> -# REVERSE-NEXT: 2006c: ef ef ef ef <unknown> + # REVERSE: fnpic: # REVERSE-NEXT: 20070: 00 00 00 00 nop -# REVERSE-NEXT: Disassembly of section differentos: + +# REVERSE: Disassembly of section differentos: # REVERSE-NEXT: __start: # REVERSE-NEXT: 20074: 0c 00 80 00 jal 131072 <__LA25Thunk_foo1a> # REVERSE-NEXT: 20078: 00 00 00 00 nop Index: test/ELF/mips-npic-call-pic-script.s =================================================================== --- test/ELF/mips-npic-call-pic-script.s +++ test/ELF/mips-npic-call-pic-script.s @@ -19,91 +19,28 @@ # CHECK-NEXT: 20004: 08 00 80 08 j 131104 <foo1a> # CHECK-NEXT: 20008: 27 39 00 20 addiu $25, $25, 32 # CHECK-NEXT: 2000c: 00 00 00 00 nop + # CHECK: __LA25Thunk_foo1b: # CHECK-NEXT: 20010: 3c 19 00 02 lui $25, 2 # CHECK-NEXT: 20014: 08 00 80 09 j 131108 <foo1b> # CHECK-NEXT: 20018: 27 39 00 24 addiu $25, $25, 36 # CHECK-NEXT: 2001c: 00 00 00 00 nop + # CHECK: foo1a: # CHECK-NEXT: 20020: 00 00 00 00 nop + # CHECK: foo1b: # CHECK-NEXT: 20024: 00 00 00 00 nop + # CHECK: __LA25Thunk_foo2: # CHECK-NEXT: 20028: 3c 19 00 02 lui $25, 2 # CHECK-NEXT: 2002c: 08 00 80 10 j 131136 <foo2> # CHECK-NEXT: 20030: 27 39 00 40 addiu $25, $25, 64 # CHECK-NEXT: 20034: 00 00 00 00 nop -# CHECK-NEXT: 20038: ef ef ef ef <unknown> -# CHECK-NEXT: 2003c: ef ef ef ef <unknown> + # CHECK: foo2: # CHECK-NEXT: 20040: 00 00 00 00 nop -# CHECK-NEXT: 20044: ef ef ef ef <unknown> -# CHECK-NEXT: 20048: ef ef ef ef <unknown> -# CHECK-NEXT: 2004c: ef ef ef ef <unknown> -# CHECK-NEXT: 20050: ef ef ef ef <unknown> -# CHECK-NEXT: 20054: ef ef ef ef <unknown> -# CHECK-NEXT: 20058: ef ef ef ef <unknown> -# CHECK-NEXT: 2005c: ef ef ef ef <unknown> -# CHECK-NEXT: 20060: ef ef ef ef <unknown> -# CHECK-NEXT: 20064: ef ef ef ef <unknown> -# CHECK-NEXT: 20068: ef ef ef ef <unknown> -# CHECK-NEXT: 2006c: ef ef ef ef <unknown> -# CHECK-NEXT: 20070: ef ef ef ef <unknown> -# CHECK-NEXT: 20074: ef ef ef ef <unknown> -# CHECK-NEXT: 20078: ef ef ef ef <unknown> -# CHECK-NEXT: 2007c: ef ef ef ef <unknown> -# CHECK-NEXT: 20080: ef ef ef ef <unknown> -# CHECK-NEXT: 20084: ef ef ef ef <unknown> -# CHECK-NEXT: 20088: ef ef ef ef <unknown> -# CHECK-NEXT: 2008c: ef ef ef ef <unknown> -# CHECK-NEXT: 20090: ef ef ef ef <unknown> -# CHECK-NEXT: 20094: ef ef ef ef <unknown> -# CHECK-NEXT: 20098: ef ef ef ef <unknown> -# CHECK-NEXT: 2009c: ef ef ef ef <unknown> -# CHECK-NEXT: 200a0: ef ef ef ef <unknown> -# CHECK-NEXT: 200a4: ef ef ef ef <unknown> -# CHECK-NEXT: 200a8: ef ef ef ef <unknown> -# CHECK-NEXT: 200ac: ef ef ef ef <unknown> -# CHECK-NEXT: 200b0: ef ef ef ef <unknown> -# CHECK-NEXT: 200b4: ef ef ef ef <unknown> -# CHECK-NEXT: 200b8: ef ef ef ef <unknown> -# CHECK-NEXT: 200bc: ef ef ef ef <unknown> -# CHECK-NEXT: 200c0: ef ef ef ef <unknown> -# CHECK-NEXT: 200c4: ef ef ef ef <unknown> -# CHECK-NEXT: 200c8: ef ef ef ef <unknown> -# CHECK-NEXT: 200cc: ef ef ef ef <unknown> -# CHECK-NEXT: 200d0: ef ef ef ef <unknown> -# CHECK-NEXT: 200d4: ef ef ef ef <unknown> -# CHECK-NEXT: 200d8: ef ef ef ef <unknown> -# CHECK-NEXT: 200dc: ef ef ef ef <unknown> -# CHECK-NEXT: 200e0: ef ef ef ef <unknown> -# CHECK-NEXT: 200e4: ef ef ef ef <unknown> -# CHECK-NEXT: 200e8: ef ef ef ef <unknown> -# CHECK-NEXT: 200ec: ef ef ef ef <unknown> -# CHECK-NEXT: 200f0: ef ef ef ef <unknown> -# CHECK-NEXT: 200f4: ef ef ef ef <unknown> -# CHECK-NEXT: 200f8: ef ef ef ef <unknown> -# CHECK-NEXT: 200fc: ef ef ef ef <unknown> -# CHECK-NEXT: 20100: ef ef ef ef <unknown> -# CHECK-NEXT: 20104: ef ef ef ef <unknown> -# CHECK-NEXT: 20108: ef ef ef ef <unknown> -# CHECK-NEXT: 2010c: ef ef ef ef <unknown> -# CHECK-NEXT: 20110: ef ef ef ef <unknown> -# CHECK-NEXT: 20114: ef ef ef ef <unknown> -# CHECK-NEXT: 20118: ef ef ef ef <unknown> -# CHECK-NEXT: 2011c: ef ef ef ef <unknown> -# CHECK-NEXT: 20120: ef ef ef ef <unknown> -# CHECK-NEXT: 20124: ef ef ef ef <unknown> -# CHECK-NEXT: 20128: ef ef ef ef <unknown> -# CHECK-NEXT: 2012c: ef ef ef ef <unknown> -# CHECK-NEXT: 20130: ef ef ef ef <unknown> -# CHECK-NEXT: 20134: ef ef ef ef <unknown> -# CHECK-NEXT: 20138: ef ef ef ef <unknown> -# CHECK-NEXT: 2013c: ef ef ef ef <unknown> -# CHECK-NEXT: 20140: ef ef ef ef <unknown> -# CHECK-NEXT: 20144: ef ef ef ef <unknown> -# CHECK-NEXT: 20148: ef ef ef ef <unknown> -# CHECK-NEXT: 2014c: ef ef ef ef <unknown> + # CHECK: __start: # CHECK-NEXT: 20150: 0c 00 80 00 jal 131072 <__LA25Thunk_foo1a> # CHECK-NEXT: 20154: 00 00 00 00 nop @@ -117,16 +54,16 @@ # CHECK-NEXT: 20174: 00 00 00 00 nop # CHECK-NEXT: 20178: 0c 00 80 68 jal 131488 <fnpic> # CHECK-NEXT: 2017c: 00 00 00 00 nop + # CHECK: __LA25Thunk_fpic: # CHECK-NEXT: 20180: 3c 19 00 02 lui $25, 2 # CHECK-NEXT: 20184: 08 00 80 64 j 131472 <fpic> # CHECK-NEXT: 20188: 27 39 01 90 addiu $25, $25, 400 # CHECK-NEXT: 2018c: 00 00 00 00 nop + # CHECK: fpic: # CHECK-NEXT: 20190: 00 00 00 00 nop -# CHECK-NEXT: 20194: ef ef ef ef <unknown> -# CHECK-NEXT: 20198: ef ef ef ef <unknown> -# CHECK-NEXT: 2019c: ef ef ef ef <unknown> + # CHECK: fnpic: # CHECK-NEXT: 201a0: 00 00 00 00 nop @@ -145,6 +82,7 @@ # RUN: echo "SECTIONS { .text 0x20000 : { *(.text) } }" > %t2.script # RUN: ld.lld --script %t2.script %t-npic.o %t-pic.o %t-sto-pic.o -o %t2.exe # RUN: llvm-objdump -d %t2.exe | FileCheck -check-prefix=ORPH1 %s + # ORPH1: Disassembly of section .text: # ORPH1-NEXT: __start: # ORPH1-NEXT: 20000: 0c 00 80 15 jal 131156 <__LA25Thunk_foo1a> @@ -159,42 +97,43 @@ # ORPH1-NEXT: 20024: 00 00 00 00 nop # ORPH1-NEXT: 20028: 0c 00 80 14 jal 131152 <fnpic> # ORPH1-NEXT: 2002c: 00 00 00 00 nop + # ORPH1: __LA25Thunk_fpic: # ORPH1-NEXT: 20030: 3c 19 00 02 lui $25, 2 # ORPH1-NEXT: 20034: 08 00 80 10 j 131136 <fpic> # ORPH1-NEXT: 20038: 27 39 00 40 addiu $25, $25, 64 # ORPH1-NEXT: 2003c: 00 00 00 00 nop + # ORPH1: fpic: # ORPH1-NEXT: 20040: 00 00 00 00 nop -# ORPH1-NEXT: 20044: ef ef ef ef <unknown> -# ORPH1-NEXT: 20048: ef ef ef ef <unknown> -# ORPH1-NEXT: 2004c: ef ef ef ef <unknown> + # ORPH1: fnpic: # ORPH1-NEXT: 20050: 00 00 00 00 nop + # ORPH1: __LA25Thunk_foo1a: # ORPH1-NEXT: 20054: 3c 19 00 02 lui $25, 2 # ORPH1-NEXT: 20058: 08 00 80 20 j 131200 <foo1a> # ORPH1-NEXT: 2005c: 27 39 00 80 addiu $25, $25, 128 # ORPH1-NEXT: 20060: 00 00 00 00 nop + # ORPH1: __LA25Thunk_foo1b: # ORPH1-NEXT: 20064: 3c 19 00 02 lui $25, 2 # ORPH1-NEXT: 20068: 08 00 80 21 j 131204 <foo1b> # ORPH1-NEXT: 2006c: 27 39 00 84 addiu $25, $25, 132 # ORPH1-NEXT: 20070: 00 00 00 00 nop -# ORPH1-NEXT: 20074: ef ef ef ef <unknown> -# ORPH1-NEXT: 20078: ef ef ef ef <unknown> -# ORPH1-NEXT: 2007c: ef ef ef ef <unknown> + # ORPH1: foo1a: # ORPH1-NEXT: 20080: 00 00 00 00 nop + # ORPH1: foo1b: # ORPH1-NEXT: 20084: 00 00 00 00 nop + # ORPH1: __LA25Thunk_foo2: # ORPH1-NEXT: 20088: 3c 19 00 02 lui $25, 2 # ORPH1-NEXT: 2008c: 08 00 80 28 j 131232 <foo2> # ORPH1-NEXT: 20090: 27 39 00 a0 addiu $25, $25, 160 # ORPH1-NEXT: 20094: 00 00 00 00 nop -# ORPH1-NEXT: 20098: ef ef ef ef <unknown> -# ORPH1-NEXT: 2009c: ef ef ef ef <unknown> + # ORPH1: foo2: # ORPH1-NEXT: 200a0: 00 00 00 00 nop @@ -203,6 +142,7 @@ # RUN: echo "SECTIONS { .out 0x20000 : { *(.text) } }" > %t3.script # RUN: ld.lld --script %t3.script %t-npic.o %t-pic.o %t-sto-pic.o -o %t3.exe # RUN: llvm-objdump -d %t3.exe | FileCheck -check-prefix=ORPH2 %s + # ORPH2: Disassembly of section .out: # ORPH2-NEXT: __start: # ORPH2-NEXT: 20000: 0c 00 80 18 jal 131168 <__LA25Thunk_foo1a> @@ -217,39 +157,43 @@ # ORPH2-NEXT: 20024: 00 00 00 00 nop # ORPH2-NEXT: 20028: 0c 00 80 14 jal 131152 <fnpic> # ORPH2-NEXT: 2002c: 00 00 00 00 nop + # ORPH2: __LA25Thunk_fpic: # ORPH2-NEXT: 20030: 3c 19 00 02 lui $25, 2 # ORPH2-NEXT: 20034: 08 00 80 10 j 131136 <fpic> # ORPH2-NEXT: 20038: 27 39 00 40 addiu $25, $25, 64 # ORPH2-NEXT: 2003c: 00 00 00 00 nop + # ORPH2: fpic: # ORPH2-NEXT: 20040: 00 00 00 00 nop -# ORPH2-NEXT: 20044: ef ef ef ef <unknown> -# ORPH2-NEXT: 20048: ef ef ef ef <unknown> -# ORPH2-NEXT: 2004c: ef ef ef ef <unknown> + # ORPH2: fnpic: # ORPH2-NEXT: 20050: 00 00 00 00 nop # ORPH2-NEXT: Disassembly of section .text: + # ORPH2-NEXT: __LA25Thunk_foo1a: # ORPH2-NEXT: 20060: 3c 19 00 02 lui $25, 2 # ORPH2-NEXT: 20064: 08 00 80 20 j 131200 <foo1a> # ORPH2-NEXT: 20068: 27 39 00 80 addiu $25, $25, 128 # ORPH2-NEXT: 2006c: 00 00 00 00 nop + # ORPH2: __LA25Thunk_foo1b: # ORPH2-NEXT: 20070: 3c 19 00 02 lui $25, 2 # ORPH2-NEXT: 20074: 08 00 80 21 j 131204 <foo1b> # ORPH2-NEXT: 20078: 27 39 00 84 addiu $25, $25, 132 # ORPH2-NEXT: 2007c: 00 00 00 00 nop + # ORPH2: foo1a: # ORPH2-NEXT: 20080: 00 00 00 00 nop + # ORPH2: foo1b: # ORPH2-NEXT: 20084: 00 00 00 00 nop + # ORPH2: __LA25Thunk_foo2: # ORPH2-NEXT: 20088: 3c 19 00 02 lui $25, 2 # ORPH2-NEXT: 2008c: 08 00 80 28 j 131232 <foo2> # ORPH2-NEXT: 20090: 27 39 00 a0 addiu $25, $25, 160 # ORPH2-NEXT: 20094: 00 00 00 00 nop -# ORPH2-NEXT: 20098: ef ef ef ef <unknown> -# ORPH2-NEXT: 2009c: ef ef ef ef <unknown> + # ORPH2: foo2: # ORPH2-NEXT: 200a0: 00 00 00 00 nop Index: test/ELF/mips-npic-call-pic.s =================================================================== --- test/ELF/mips-npic-call-pic.s +++ test/ELF/mips-npic-call-pic.s @@ -51,8 +51,6 @@ # CHECK-NEXT: 2005c: 08 00 80 1c j 131184 <foo2> # CHECK-NEXT: 20060: 27 39 00 70 addiu $25, $25, 112 # CHECK-NEXT: 20064: 00 00 00 00 nop -# CHECK-NEXT: 20068: ef ef ef ef <unknown> -# CHECK-NEXT: 2006c: ef ef ef ef <unknown> # CHECK: foo2: # CHECK-NEXT: 20070: 00 00 00 00 nop @@ -62,15 +60,9 @@ # CHECK-NEXT: 20078: 08 00 80 24 j 131216 <fpic> # CHECK-NEXT: 2007c: 27 39 00 90 addiu $25, $25, 144 # CHECK-NEXT: 20080: 00 00 00 00 nop -# CHECK-NEXT: 20084: ef ef ef ef <unknown> -# CHECK-NEXT: 20088: ef ef ef ef <unknown> -# CHECK-NEXT: 2008c: ef ef ef ef <unknown> # CHECK: fpic: # CHECK-NEXT: 20090: 00 00 00 00 nop -# CHECK-NEXT: 20094: ef ef ef ef <unknown> -# CHECK-NEXT: 20098: ef ef ef ef <unknown> -# CHECK-NEXT: 2009c: ef ef ef ef <unknown> # CHECK: fnpic: # CHECK-NEXT: 200a0: 00 00 00 00 nop @@ -87,27 +79,28 @@ # REVERSE-NEXT: 20004: 08 00 80 08 j 131104 <foo1a> # REVERSE-NEXT: 20008: 27 39 00 20 addiu $25, $25, 32 # REVERSE-NEXT: 2000c: 00 00 00 00 nop + # REVERSE: __LA25Thunk_foo1b: # REVERSE-NEXT: 20010: 3c 19 00 02 lui $25, 2 # REVERSE-NEXT: 20014: 08 00 80 09 j 131108 <foo1b> # REVERSE-NEXT: 20018: 27 39 00 24 addiu $25, $25, 36 # REVERSE-NEXT: 2001c: 00 00 00 00 nop + # REVERSE: foo1a: # REVERSE-NEXT: 20020: 00 00 00 00 nop + # REVERSE: foo1b: # REVERSE-NEXT: 20024: 00 00 00 00 nop + # REVERSE: __LA25Thunk_foo2: # REVERSE-NEXT: 20028: 3c 19 00 02 lui $25, 2 # REVERSE-NEXT: 2002c: 08 00 80 10 j 131136 <foo2> # REVERSE-NEXT: 20030: 27 39 00 40 addiu $25, $25, 64 # REVERSE-NEXT: 20034: 00 00 00 00 nop -# REVERSE-NEXT: 20038: ef ef ef ef <unknown> -# REVERSE-NEXT: 2003c: ef ef ef ef <unknown> + # REVERSE: foo2: # REVERSE-NEXT: 20040: 00 00 00 00 nop -# REVERSE-NEXT: 20044: ef ef ef ef <unknown> -# REVERSE-NEXT: 20048: ef ef ef ef <unknown> -# REVERSE-NEXT: 2004c: ef ef ef ef <unknown> + # REVERSE: __start: # REVERSE-NEXT: 20050: 0c 00 80 00 jal 131072 <__LA25Thunk_foo1a> # REVERSE-NEXT: 20054: 00 00 00 00 nop @@ -121,16 +114,16 @@ # REVERSE-NEXT: 20074: 00 00 00 00 nop # REVERSE-NEXT: 20078: 0c 00 80 28 jal 131232 <fnpic> # REVERSE-NEXT: 2007c: 00 00 00 00 nop + # REVERSE: __LA25Thunk_fpic: # REVERSE-NEXT: 20080: 3c 19 00 02 lui $25, 2 # REVERSE-NEXT: 20084: 08 00 80 24 j 131216 <fpic> # REVERSE-NEXT: 20088: 27 39 00 90 addiu $25, $25, 144 # REVERSE-NEXT: 2008c: 00 00 00 00 nop + # REVERSE: fpic: # REVERSE-NEXT: 20090: 00 00 00 00 nop -# REVERSE-NEXT: 20094: ef ef ef ef <unknown> -# REVERSE-NEXT: 20098: ef ef ef ef <unknown> -# REVERSE-NEXT: 2009c: ef ef ef ef <unknown> + # REVERSE: fnpic: # REVERSE-NEXT: 200a0: 00 00 00 00 nop Index: test/ELF/mips-traps.s =================================================================== --- test/ELF/mips-traps.s +++ test/ELF/mips-traps.s @@ -0,0 +1,22 @@ +# Check trap instruction encoding. + +# REQUIRES: mips + +# RUN: llvm-mc -filetype=obj -triple=mips-unknown-linux -mcpu=mips32r6 -o %t.o %s +# RUN: ld.lld -r -o %t %t.o %t.o +# RUN: llvm-objdump -d -r %t | FileCheck --check-prefix=EB %s + +# RUN: llvm-mc -filetype=obj -triple=mipsel-unknown-linux -mcpu=mips32r6 -o %t.o %s +# RUN: ld.lld -r -o %t %t.o %t.o +# RUN: llvm-objdump -d -r %t | FileCheck --check-prefix=EL %s + +# EB: 8: 04 17 00 01 sigrie 1 +# EL: 8: 01 00 17 04 sigrie 1 + + .text + lw $t9, %got(.data)($gp) + addiu $a0, $t9, %lo(.data) + + .data +data: + .word 0