llvm-project/lld/test/elf/Mips/rel-dynamic-11.test

111 lines
2.3 KiB
Plaintext

# Conditions:
# a) Linking a shared library.
# b) Relocations' targets are symbols defined in the other shared object.
# Check:
# a) Emitting R_MIPS_REL32 relocations for both symbols.
# b) There should be no PLT entries.
#
# RUN: yaml2obj -format=elf -docnum 1 %s > %t-so.o
# RUN: lld -flavor gnu -target mipsel -shared -o %t1.so %t-so.o
# RUN: yaml2obj -format=elf -docnum 2 %s > %t-o.o
# RUN: lld -flavor gnu -target mipsel -shared -o %t2.so %t-o.o %t1.so
# RUN: llvm-readobj -dt -r -s %t2.so | FileCheck -check-prefix=PLT-SYM %s
# PLT-SYM: Sections [
# PLT-SYM: Section {
# PLT-SYM-NOT: Name: .plt ({{[0-9]+}})
#
# PLT-SYM: Relocations [
# PLT-SYM-NEXT: Section (4) .rel.dyn {
# PLT-SYM-NEXT: 0x150 R_MIPS_REL32 T1 0x0
# PLT-SYM-NEXT: 0x2000 R_MIPS_REL32 T1 0x0
# PLT-SYM-NEXT: }
# PLT-SYM-NEXT: ]
#
# PLT-SYM: Name: T1@ (7)
# PLT-SYM-NEXT: Value: 0x0
# PLT-SYM-NEXT: Size: 0
# PLT-SYM-NEXT: Binding: Global (0x1)
# PLT-SYM-NEXT: Type: Function (0x2)
# PLT-SYM-NEXT: Other: 0
# PLT-SYM-NEXT: Section: Undefined (0x0)
# so.o
---
FileHeader:
Class: ELFCLASS32
Data: ELFDATA2LSB
Type: ET_REL
Machine: EM_MIPS
Flags: [EF_MIPS_PIC, EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32]
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
# o.o
---
FileHeader:
Class: ELFCLASS32
Data: ELFDATA2LSB
Type: ET_REL
Machine: EM_MIPS
Flags: [EF_MIPS_PIC, EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32]
Sections:
- Name: .text
Type: SHT_PROGBITS
Size: 0x08
AddressAlign: 16
Flags: [SHF_EXECINSTR, SHF_ALLOC]
- Name: .data
Type: SHT_PROGBITS
Size: 0x08
AddressAlign: 16
Flags: [SHF_WRITE, SHF_ALLOC]
- Name: .rel.text
Type: SHT_REL
Info: .text
AddressAlign: 4
Relocations:
- Offset: 0x00
Symbol: T1
Type: R_MIPS_32
- Name: .rel.data
Type: SHT_REL
Info: .data
AddressAlign: 4
Relocations:
- Offset: 0x00
Symbol: T1
Type: R_MIPS_32
Symbols:
Global:
- Name: T0
Section: .text
Type: STT_FUNC
Value: 0x0
Size: 4
- Name: T1
- Name: D0
Section: .data
Type: STT_OBJECT
Value: 0x0
Size: 8
...