llvm-project/lld/test/elf/Mips/rel-pc7-10-16-23.test

87 lines
2.6 KiB
Plaintext

# Check handling of R_MICROMIPS_PC7_S1, R_MICROMIPS_PC10_S1,
# R_MICROMIPS_PC16_S1, and R_MICROMIPS_PC23_S2 relocations.
# RUN: yaml2obj -format=elf %s > %t-obj
# RUN: lld -flavor gnu -target mipsel -o %t-exe %t-obj
# RUN: llvm-objdump -s -t %t-exe | FileCheck %s
# CHECK: Contents of section .text:
# CHECK-NEXT: {{[0-9A-F]+}} 00000000 80780500 a240fcff 000c03cc
# ^^ addiu s1,$pc,20
# ^^ bnezc v0,400114 <__start+0x4>
# ^^ b 400126 <L1>
# CHECK-NEXT: {{[0-9A-F]+}} 000c03ad 00000000 00000000 00000000
# ^^ bnez v0,40012a <L2>
# CHECK: SYMBOL TABLE:
# CHECK: {{[0-9a-f]+}} l F .text 00000002 L0
# CHECK: {{[0-9a-f]+}} l F .text 00000004 L1
# CHECK: {{[0-9a-f]+}} l F .text 00000004 L2
# CHECK: {{[0-9a-f]+}} l F .text 00000002 L3
# CHECK: {{[0-9a-f]+}} g F .text 00000014 __start
!ELF
FileHeader: !FileHeader
Class: ELFCLASS32
Data: ELFDATA2LSB
Type: ET_REL
Machine: EM_MIPS
Flags: [ EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32R2,
EF_MIPS_MICROMIPS ]
Sections:
- Name: .text
Type: SHT_PROGBITS
# v nop v nop v L0
Content: "0000000080780100a240f5ff000cfdcf000c7dad000000000000000000000000"
# ^ PC23 ^ PC16 ^ PC10 ^ PC7 ^ L1 ^ L2 ^ L3
# 7d << 1 = -6 => L3 + 2 - 6 = L2
# 3fd << 1 = -6 => L2 + 2 - 6 = L1
# fff5 << 1 = -22 => L1 + 2 - 22 = __start
# 1 << 2 = 4 => L0 + 4 - 4 = L0
AddressAlign: 16
Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
- Name: .rel.text
Type: SHT_REL
Info: .text
AddressAlign: 4
Relocations:
- Offset: 4
Symbol: L0
Type: R_MICROMIPS_PC23_S2
- Offset: 8
Symbol: L1
Type: R_MICROMIPS_PC16_S1
- Offset: 14
Symbol: L2
Type: R_MICROMIPS_PC10_S1
- Offset: 18
Symbol: L3
Type: R_MICROMIPS_PC7_S1
Symbols:
Local:
- Name: L0
Section: .text
Value: 20
Other: [ STO_MIPS_MICROMIPS ]
- Name: L1
Section: .text
Value: 22
Other: [ STO_MIPS_MICROMIPS ]
- Name: L2
Section: .text
Value: 26
Other: [ STO_MIPS_MICROMIPS ]
- Name: L3
Section: .text
Value: 30
Other: [ STO_MIPS_MICROMIPS ]
Global:
- Name: __start
Section: .text
Type: STT_FUNC
Value: 0x0
Size: 32
Other: [ STO_MIPS_MICROMIPS ]