llvm-project/lld/test/elf/Mips/rel-pc32.test

60 lines
1.3 KiB
Plaintext

# Check handling of R_MIPS_PC32 relocation.
# 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 .data:
# CHECK-NEXT: 402000 00000000 05000080 fdffff7f ............
# ^^ data2 + 0x80000001 - data1
# ^^ data1 + 0x80000001 - data2
# CHECK: SYMBOL TABLE:
# CHECK: 00402004 g .data 00000004 data1
# CHECK: 00402008 g .data 00000004 data2
!ELF
FileHeader: !FileHeader
Class: ELFCLASS32
Data: ELFDATA2LSB
Type: ET_REL
Machine: EM_MIPS
Flags: [EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32]
Sections:
- Name: .text
Type: SHT_PROGBITS
Content: "00000000"
AddressAlign: 16
Flags: [SHF_ALLOC]
- Name: .data
Type: SHT_PROGBITS
Content: "000000000100008001000080"
AddressAlign: 16
Flags: [SHF_ALLOC, SHF_WRITE]
- Name: .rel.data
Type: SHT_REL
Info: .data
AddressAlign: 4
Relocations:
- Offset: 0x4
Symbol: data2
Type: R_MIPS_PC32
- Offset: 0x8
Symbol: data1
Type: R_MIPS_PC32
Symbols:
Global:
- Name: __start
Section: .text
Value: 0x0
Size: 4
- Name: data1
Section: .data
Value: 0x4
Size: 4
- Name: data2
Section: .data
Value: 0x8
Size: 4