llvm-project/lld/test/elf/Mips/static-01.test

120 lines
2.6 KiB
Plaintext

# Check handling relocations against _gp/__gnu_local_gp symbols
# in case of "-static" linking.
# RUN: yaml2obj -format=elf -docnum 1 %s > %t1.o
# RUN: yaml2obj -format=elf -docnum 2 %s > %t2.o
# RUN: lld -flavor gnu -target mipsel -e T0 -static -o %t.exe %t1.o %t2.o
# RUN: llvm-nm %t.exe | FileCheck %s
# CHECK: 00401000 N _GLOBAL_OFFSET_TABLE_
# CHECK: 00408ff0 A __gnu_local_gp
# CHECK: 00408ff0 A _gp
# CHECK: 00408ff0 A _gp_disp
# o1.o
---
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
Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
AddressAlign: 16
Size: 28
- Name: .rel.text
Type: SHT_REL
Link: .symtab
AddressAlign: 4
Info: .text
Relocations:
- Offset: 0
Symbol: .data
Type: R_MIPS_HI16
- Offset: 4
Symbol: .data
Type: R_MIPS_LO16
- Offset: 8
Symbol: T1
Type: R_MIPS_26
- Offset: 12
Symbol: _gp
Type: R_MIPS_HI16
- Offset: 16
Symbol: _gp
Type: R_MIPS_LO16
- Offset: 20
Symbol: __gnu_local_gp
Type: R_MIPS_HI16
- Offset: 24
Symbol: __gnu_local_gp
Type: R_MIPS_LO16
- Name: .data
Type: SHT_PROGBITS
Flags: [ SHF_WRITE, SHF_ALLOC ]
AddressAlign: 16
Size: 4
- Name: .pdr
Type: SHT_PROGBITS
AddressAlign: 4
Size: 4
- Name: .rel.pdr
Type: SHT_REL
Link: .symtab
AddressAlign: 4
Info: .pdr
Relocations:
- Offset: 0
Symbol: T0
Type: R_MIPS_32
Symbols:
Local:
- Type: STT_SECTION
Section: .text
- Type: STT_SECTION
Section: .data
- Type: STT_SECTION
Section: .pdr
Global:
- Name: T0
Type: STT_FUNC
Section: .text
Size: 28
- Name: T1
- Name: _gp
- Name: __gnu_local_gp
# o2.o
---
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
Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
AddressAlign: 16
Size: 4
Symbols:
Global:
- Name: T1
Type: STT_FUNC
Section: .text
Size: 20
...