forked from OSchip/llvm-project
104 lines
2.8 KiB
Plaintext
104 lines
2.8 KiB
Plaintext
# Check that R_MIPS32 relocation against __gnu_local_gp causes emitting
|
|
# of R_MIPS_REL32 relocation in case of shared library file linking
|
|
# and does not produce any dynamic relocation in case of linking a non-shared
|
|
# executable file.
|
|
|
|
# Now the test failed because the __gnu_local_gp symbol becomes defined
|
|
# absolute symbol and we do not generate R_MIPS_REL32 in case of shared
|
|
# library linking.
|
|
# XFAIL: *
|
|
|
|
# RUN: yaml2obj -format=elf -docnum 1 %s > %t-so.o
|
|
# RUN: lld -flavor gnu -target mipsel -shared -o %t-1.so %t-so.o
|
|
# RUN: yaml2obj -format=elf -docnum 2 %s > %t-o.o
|
|
# RUN: lld -flavor gnu -target mipsel -e T0 -o %t.exe %t-o.o %t-1.so
|
|
# RUN: llvm-readobj -r %t.exe | FileCheck -check-prefix=EXE %s
|
|
# RUN: lld -flavor gnu -target mipsel -shared -o %t-2.so %t-o.o %t-1.so
|
|
# RUN: llvm-readobj -r %t-2.so | FileCheck -check-prefix=SO %s
|
|
|
|
# EXE: Relocations [
|
|
# EXE-NEXT: ]
|
|
|
|
# SO: Relocations [
|
|
# SO-NEXT: Section (5) .rel.dyn {
|
|
# SO-NEXT: 0x0 R_MIPS_NONE - 0x0
|
|
# SO-NEXT: 0x2EC R_MIPS_REL32 __gnu_local_gp 0x0
|
|
# SO-NEXT: }
|
|
# SO-NEXT: ]
|
|
|
|
# so.so
|
|
---
|
|
FileHeader:
|
|
Class: ELFCLASS32
|
|
Data: ELFDATA2LSB
|
|
Type: ET_REL
|
|
Machine: EM_MIPS
|
|
Flags: [EF_MIPS_PIC, EF_MIPS_CPIC]
|
|
|
|
Sections:
|
|
- Name: .text
|
|
Type: SHT_PROGBITS
|
|
Size: 0x0C
|
|
AddressAlign: 16
|
|
Flags: [SHF_EXECINSTR, SHF_ALLOC]
|
|
|
|
Symbols:
|
|
Global:
|
|
- Name: T1
|
|
Section: .text
|
|
Type: STT_FUNC
|
|
Value: 0x0
|
|
Size: 4
|
|
- Name: T2
|
|
Section: .text
|
|
Type: STT_FUNC
|
|
Value: 0x4
|
|
Size: 4
|
|
|
|
# o.o
|
|
---
|
|
FileHeader:
|
|
Class: ELFCLASS32
|
|
Data: ELFDATA2LSB
|
|
OSABI: ELFOSABI_GNU
|
|
Type: ET_REL
|
|
Machine: EM_MIPS
|
|
Flags: [ EF_MIPS_NOREORDER, EF_MIPS_CPIC, EF_MIPS_PIC,
|
|
EF_MIPS_ABI_O32, EF_MIPS_ARCH_32R2 ]
|
|
Sections:
|
|
- Name: .text
|
|
Type: SHT_PROGBITS
|
|
Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
|
|
AddressAlign: 0x04
|
|
Size: 12
|
|
- Name: .rel.text
|
|
Type: SHT_REL
|
|
Link: .symtab
|
|
Info: .text
|
|
AddressAlign: 0x04
|
|
Relocations:
|
|
- Offset: 0x00
|
|
Symbol: __gnu_local_gp
|
|
Type: R_MIPS_32
|
|
- Offset: 0x04
|
|
Symbol: T1
|
|
Type: R_MIPS_LO16
|
|
- Offset: 0x08
|
|
Symbol: T2
|
|
Type: R_MIPS_CALL16
|
|
|
|
Symbols:
|
|
Local:
|
|
- Name: .text
|
|
Type: STT_SECTION
|
|
Section: .text
|
|
Global:
|
|
- Name: T0
|
|
Type: STT_FUNC
|
|
Section: .text
|
|
Size: 0x08
|
|
- Name: __gnu_local_gp
|
|
- Name: T1
|
|
- Name: T2
|
|
...
|