llvm-project/lld/test/old-elf/Mips/rel-jalr-01.test

102 lines
2.4 KiB
Plaintext

# REQUIRES: mips
# Check handling of the R_MIPS_JALR relocation.
# RUN: yaml2obj -format=elf -docnum 1 %s > %t1.o
# RUN: lld -flavor old-gnu -target mipsel -shared -o %t.so %t1.o
# RUN: yaml2obj -format=elf -docnum 2 %s > %t2.o
# RUN: lld -flavor old-gnu -target mipsel -o %t.exe %t2.o %t.so
# RUN: llvm-objdump -d %t.exe | FileCheck %s
# CHECK: __start:
# CHECK-NEXT: {{[0-9a-f]+}}: 05 00 11 04 bal 24
# CHECK-NEXT: {{[0-9a-f]+}}: 00 00 00 00 nop
# CHECK-NEXT: {{[0-9a-f]+}}: 04 00 00 10 b 20
# CHECK-NEXT: {{[0-9a-f]+}}: 00 00 00 00 nop
# CHECK-NEXT: {{[0-9a-f]+}}: 09 f8 20 03 jalr $25
# CHECK-NEXT: {{[0-9a-f]+}}: 00 00 00 00 nop
# t1.o
---
FileHeader:
Class: ELFCLASS32
Data: ELFDATA2LSB
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: 16
Size: 4
Symbols:
Global:
- Name: T3
Type: STT_FUNC
Section: .text
Value: 0
Size: 4
# t2.o
---
FileHeader:
Class: ELFCLASS32
Data: ELFDATA2LSB
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: 16
Content: "09f8200300000000080020030000000009f82003000000000000000000000000"
# ^ jalr T1 ^ j T2 ^ jalr T3
- Name: .rel.text
Type: SHT_REL
Link: .symtab
AddressAlign: 4
Info: .text
Relocations:
- Offset: 0
Symbol: T1
Type: R_MIPS_JALR
- Offset: 8
Symbol: T2
Type: R_MIPS_JALR
- Offset: 16
Symbol: T3
Type: R_MIPS_JALR
- Name: .data
Type: SHT_PROGBITS
Flags: [ SHF_WRITE, SHF_ALLOC ]
AddressAlign: 16
Size: 0
Symbols:
Local:
- Name: T1
Type: STT_FUNC
Section: .text
Value: 24
Size: 4
Global:
- Name: __start
Type: STT_FUNC
Section: .text
Value: 0
Size: 24
- Name: T2
Type: STT_FUNC
Section: .text
Value: 28
Size: 4
- Name: T3
...