llvm-project/lld/test/elf/Mips/plt-header-be.test

105 lines
2.7 KiB
Plaintext

# REQUIRES: mips
# Check initialization of big-endian .plt header entries.
# Build shared library
# RUN: yaml2obj -format=elf -docnum 1 %s > %t-so.o
# RUN: lld -flavor gnu -target mips -shared -o %t.so %t-so.o
# Build executable
# RUN: yaml2obj -format=elf -docnum 2 %s > %t-o.o
# RUN: lld -flavor gnu -target mips -o %t.exe %t-o.o %t.so
# RUN: llvm-objdump -section-headers -disassemble %t.exe | FileCheck %s
# CHECK: Disassembly of section .plt:
# CHECK-NEXT: .plt:
# CHECK-NEXT: 400160: 3c 1c 00 40 lui $gp, 64
# CHECK-NEXT: 400164: 8f 99 20 00 lw $25, 8192($gp)
# CHECK-NEXT: 400168: 27 9c 20 00 addiu $gp, $gp, 8192
# CHECK-NEXT: 40016c: 03 1c c0 23 subu $24, $24, $gp
# CHECK-NEXT: 400170: 03 e0 78 25 move $15, $ra
# CHECK-NEXT: 400174: 00 18 c0 82 srl $24, $24, 2
# CHECK-NEXT: 400178: 03 20 f8 09 jalr $25
# CHECK-NEXT: 40017c: 27 18 ff fe addiu $24, $24, -2
# CHECK-NEXT: 400180: 3c 0f 00 40 lui $15, 64
# CHECK-NEXT: 400184: 8d f9 20 08 lw $25, 8200($15)
# CHECK-NEXT: 400188: 03 20 00 08 jr $25
# CHECK-NEXT: 40018c: 25 f8 20 08 addiu $24, $15, 8200
# CHECK: Sections:
# CHECK: Idx Name Size Address Type
# CHECK: 6 .plt 00000030 0000000000400160 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_32]
Sections:
- Name: .text
Type: SHT_PROGBITS
Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
AddressAlign: 4
Size: 32
- Name: .rel.text
Type: SHT_REL
Link: .symtab
AddressAlign: 4
Info: .text
Relocations:
- Offset: 8
Symbol: .text
Type: R_MIPS_26
- Offset: 16
Symbol: __start
Type: R_MIPS_26
- Offset: 24
Symbol: T1
Type: R_MIPS_26
Symbols:
Local:
- Name: loc
Section: .text
Value: 16
- Name: .text
Type: STT_SECTION
Section: .text
Global:
- Name: __start
Section: .text
- Name: T1
...