summaryrefslogtreecommitdiff
path: root/test/old-elf/Mips/plt-header-micro-be.test
diff options
context:
space:
mode:
Diffstat (limited to 'test/old-elf/Mips/plt-header-micro-be.test')
-rw-r--r--test/old-elf/Mips/plt-header-micro-be.test105
1 files changed, 105 insertions, 0 deletions
diff --git a/test/old-elf/Mips/plt-header-micro-be.test b/test/old-elf/Mips/plt-header-micro-be.test
new file mode 100644
index 0000000000000..e9aa51ef85ebc
--- /dev/null
+++ b/test/old-elf/Mips/plt-header-micro-be.test
@@ -0,0 +1,105 @@
+# REQUIRES: mips
+
+# Check initialization of .plt header entries
+# if all PLT entries use microMIPS big-endian encoding.
+
+# RUN: yaml2obj -format=elf -docnum 1 %s > %t1.o
+# RUN: lld -flavor old-gnu -target mips -shared -o %t.so %t1.o
+# RUN: yaml2obj -format=elf -docnum 2 %s > %t2.o
+# RUN: lld -flavor old-gnu -target mips -o %t.exe %t2.o %t.so
+# RUN: llvm-objdump -section-headers -d -mattr=micromips %t.exe | FileCheck %s
+
+# CHECK: Disassembly of section .plt:
+# CHECK-NEXT: .plt:
+# CHECK-NEXT: 400170: 79 80 07 a4 addiupc $3, 7824
+# CHECK-NEXT: 400174: ff 23 00 00 lw $25, 0($3)
+# CHECK-NEXT: 400178: 05 35 subu16 $2, $2, $3
+# CHECK-NEXT: 40017a: 25 25 srl16 $2, $2, 2
+# CHECK-NEXT: 40017c: 33 02 ff fe addiu $24, $2, -2
+# CHECK-NEXT: 400180: 0d ff move $15, $ra
+# CHECK-NEXT: 400182: 45 f9 jalrs16 $25
+# CHECK-NEXT: 400184: 0f 83 move $gp, $3
+# CHECK-NEXT: 400186: 0c 00 nop
+
+# CHECK-NEXT: 400188: 79 00 07 a0 addiupc $2, 7808
+# CHECK-NEXT: 40018c: ff 22 00 00 lw $25, 0($2)
+# CHECK-NEXT: 400190: 45 99 jr16 $25
+# CHECK-NEXT: 400192: 0f 02 move $24, $2
+
+# CHECK: Sections:
+# CHECK: Idx Name Size Address Type
+# CHECK: 6 .plt 00000024 0000000000400170 TEXT DATA
+# CHECK: 10 .got.plt 0000000c 0000000000402000 DATA
+
+# so.o
+---
+FileHeader:
+ Class: ELFCLASS32
+ Data: ELFDATA2MSB
+ Type: ET_REL
+ Machine: EM_MIPS
+ Flags: [EF_MIPS_PIC, EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32]
+
+Sections:
+ - Name: .text
+ Type: SHT_PROGBITS
+ Size: 12
+ AddressAlign: 16
+ Flags: [SHF_EXECINSTR, SHF_ALLOC]
+
+Symbols:
+ Global:
+ - Name: T1
+ Section: .text
+ Type: STT_FUNC
+ Value: 0
+ Size: 4
+
+# o.o
+---
+FileHeader:
+ Class: ELFCLASS32
+ Data: ELFDATA2MSB
+ Type: ET_REL
+ Machine: EM_MIPS
+ Flags: [EF_MIPS_PIC, EF_MIPS_CPIC, EF_MIPS_ABI_O32,
+ EF_MIPS_ARCH_32R2, EF_MIPS_MICROMIPS]
+
+Sections:
+ - Name: .text
+ Type: SHT_PROGBITS
+ Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
+ AddressAlign: 0x04
+ Content: '0000000000000000f40000000000000000000000f400000000000000f4000000'
+# jal .text jal __start jal T1
+ - Name: .rel.text
+ Type: SHT_REL
+ Link: .symtab
+ AddressAlign: 4
+ Info: .text
+ Relocations:
+ - Offset: 8
+ Symbol: .text
+ Type: R_MICROMIPS_26_S1
+ - Offset: 20
+ Symbol: __start
+ Type: R_MICROMIPS_26_S1
+ - Offset: 28
+ Symbol: T1
+ Type: R_MICROMIPS_26_S1
+
+Symbols:
+ Local:
+ - Name: loc
+ Section: .text
+ Value: 16
+ Other: [ STO_MIPS_MICROMIPS ]
+ - Name: .text
+ Type: STT_SECTION
+ Section: .text
+ Global:
+ - Name: __start
+ Section: .text
+ Other: [ STO_MIPS_MICROMIPS ]
+ - Name: T1
+...