llvm-project/lld/test/old-elf/Mips/rel-pc18-s3-micro.test

57 lines
1.6 KiB
Plaintext

# Check handling of R_MICROMIPS_PC18_S3 relocation.
# RUN: yaml2obj -format=elf %s > %t.o
# RUN: lld -flavor old-gnu -target mipsel -e T0 -o %t.exe %t.o
# RUN: llvm-objdump -s -t %t.exe | FileCheck %s
# CHECK: Contents of section .text:
# CHECK-NEXT: {{[0-9A-F]+}} 00000000 00000100 00000000 00000000
# ^ V
# A = -1 << 3 = -8 =>
# V = (T1 - 8 - (T0|7)^7) >> 3 =>
# V => 8 >> 3 = 1 (shuffled)
# CHECK: SYMBOL TABLE:
# CHECK: {{[0-9A-F]+}} g F .text 00000010 T0
# CHECK: {{[0-9A-F]+}} g F .text 00000004 T1
FileHeader:
Class: ELFCLASS32
Data: ELFDATA2LSB
Type: ET_REL
Machine: EM_MIPS
Flags: [EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32R6, EF_MIPS_MICROMIPS]
Sections:
- Name: .text
Type: SHT_PROGBITS
Content: "000000000300ffff000000000000000000000000"
# ^ T1
# ^ T0 ^ A := 0x3ffff == -1 (shuffled)
AddressAlign: 16
Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
- Name: .rel.text
Type: SHT_REL
Info: .text
AddressAlign: 4
Relocations:
- Offset: 4
Symbol: T1
Type: R_MICROMIPS_PC18_S3
Symbols:
Global:
- Name: T0
Section: .text
Type: STT_FUNC
Value: 0
Size: 16
Other: [STO_MIPS_MICROMIPS]
- Name: T1
Section: .text
Type: STT_FUNC
Value: 16
Size: 4
Other: [STO_MIPS_MICROMIPS]