forked from OSchip/llvm-project
105 lines
2.6 KiB
Plaintext
105 lines
2.6 KiB
Plaintext
# Check R_MIPS_GPREL16 relocation handling.
|
|
#
|
|
# RUN: yaml2obj -format=elf %s > %t-obj
|
|
# RUN: lld -flavor old-gnu -target mipsel -e G1 -shared -o %t.so %t-obj
|
|
# RUN: llvm-readobj -symbols %t.so | FileCheck -check-prefix=SYM %s
|
|
# RUN: llvm-objdump -s %t.so | FileCheck -check-prefix=SEC %s
|
|
|
|
# SYM: Name: L1
|
|
# SYM-NEXT: Value: 0x104
|
|
# SYM-NEXT: Size: 4
|
|
# SYM-NEXT: Binding: Local (0x0)
|
|
# SYM-NEXT: Type: Function (0x2)
|
|
# SYM-NEXT: Other: 0
|
|
# SYM-NEXT: Section: .text (0x5)
|
|
|
|
# SYM: Name: G1
|
|
# SYM-NEXT: Value: 0x108
|
|
# SYM-NEXT: Size: 4
|
|
# SYM-NEXT: Binding: Global (0x1)
|
|
# SYM-NEXT: Type: Function (0x2)
|
|
# SYM-NEXT: Other: 0
|
|
# SYM-NEXT: Section: .text (0x5)
|
|
|
|
# SYM: Name: _gp
|
|
# SYM-NEXT: Value: 0x8FF0
|
|
# SYM-NEXT: Size: 0
|
|
# SYM-NEXT: Binding: Global (0x1)
|
|
# SYM-NEXT: Type: Object (0x1)
|
|
# SYM-NEXT: Other: 0
|
|
# SYM-NEXT: Section: Absolute (0xFFF1)
|
|
|
|
# 0x6110 == 0xfffc (addend) + 0x0104 (L1) + 0xf000 (GP0) - 0x8ff0 (_gp)
|
|
# SEC: Contents of section .rodata:
|
|
# SEC-NEXT: 010c 10610008 00000000 00000000 00000000
|
|
|
|
!ELF
|
|
FileHeader:
|
|
Class: ELFCLASS32
|
|
Data: ELFDATA2LSB
|
|
Type: ET_REL
|
|
Machine: EM_MIPS
|
|
Flags: [ EF_MIPS_NOREORDER, EF_MIPS_PIC, EF_MIPS_CPIC,
|
|
EF_MIPS_ABI_O32, EF_MIPS_ARCH_32R2 ]
|
|
Sections:
|
|
- Type: SHT_PROGBITS
|
|
Name: .text
|
|
Type: SHT_PROGBITS
|
|
Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
|
|
AddressAlign: 0x04
|
|
Size: 0x08
|
|
|
|
- Type: SHT_REL
|
|
Name: .rel.text
|
|
Type: SHT_REL
|
|
Link: .symtab
|
|
Info: .text
|
|
AddressAlign: 0x04
|
|
Relocations:
|
|
- Offset: 0
|
|
Symbol: .rodata
|
|
Type: R_MIPS_GOT16
|
|
- Offset: 4
|
|
Symbol: .rodata
|
|
Type: R_MIPS_LO16
|
|
|
|
- Type: SHT_PROGBITS
|
|
Name: .rodata
|
|
Type: SHT_PROGBITS
|
|
Flags: [ SHF_ALLOC ]
|
|
AddressAlign: 0x04
|
|
Content: fcff0008000000000000000000000000
|
|
|
|
- Type: SHT_REL
|
|
Name: .rel.rodata
|
|
Type: SHT_REL
|
|
Link: .symtab
|
|
Info: .rodata
|
|
AddressAlign: 0x04
|
|
Relocations:
|
|
- Offset: 0
|
|
Symbol: L1
|
|
Type: R_MIPS_GPREL16
|
|
|
|
- Type: SHT_MIPS_REGINFO
|
|
Name: .reginfo
|
|
Type: SHT_MIPS_REGINFO
|
|
Flags: [ SHF_ALLOC ]
|
|
AddressAlign: 0x01
|
|
Content: 000000000000000000000000000000000000000000f00000
|
|
|
|
Symbols:
|
|
Local:
|
|
- Name: L1
|
|
Section: .text
|
|
Value: 0x00
|
|
Size: 0x04
|
|
- Name: .rodata
|
|
Type: STT_SECTION
|
|
Section: .rodata
|
|
Global:
|
|
- Name: G1
|
|
Section: .text
|
|
Value: 0x04
|
|
Size: 0x04
|