forked from OSchip/llvm-project
238 lines
6.0 KiB
Plaintext
238 lines
6.0 KiB
Plaintext
# Conditions:
|
|
# a) Linking a non-shared executable file.
|
|
# b) Relocations' targets are symbols defined in the shared object.
|
|
# c) Relocations are R_MIPS_PCHI16 / R_MIPS_PCLO16.
|
|
# Check:
|
|
# a) Emitting R_MIPS_REL32, R_MIPS_COPY, R_MIPS_JUMP_SLOT relocations.
|
|
# b) STO_MIPS_PLT flag in the dynamic symbol table for symbols require
|
|
# a pointer equality.
|
|
#
|
|
# RUN: yaml2obj -format=elf -docnum 1 %s > %t-so.o
|
|
# RUN: lld -flavor old-gnu -target mipsel -shared -o %t.so %t-so.o
|
|
# RUN: yaml2obj -format=elf -docnum 2 %s > %t-o.o
|
|
# RUN: lld -flavor old-gnu -target mipsel -e T0 -o %t.exe %t-o.o %t.so
|
|
# RUN: llvm-readobj -dt -r %t.exe | FileCheck -check-prefix=PLT-SYM %s
|
|
# RUN: llvm-readobj -mips-plt-got %t.exe | FileCheck -check-prefix=GOT %s
|
|
|
|
# PLT-SYM: Relocations [
|
|
# PLT-SYM-NEXT: Section (5) .rel.dyn {
|
|
# PLT-SYM-NEXT: 0x402014 R_MIPS_REL32 T2 0x0
|
|
# PLT-SYM-NEXT: 0x402014 R_MIPS_REL32 D2 0x0
|
|
# PLT-SYM-NEXT: 0x402020 R_MIPS_COPY D1 0x0
|
|
# PLT-SYM-NEXT: }
|
|
# PLT-SYM-NEXT: Section (6) .rel.plt {
|
|
# PLT-SYM-NEXT: 0x402008 R_MIPS_JUMP_SLOT T3 0x0
|
|
# PLT-SYM-NEXT: 0x40200C R_MIPS_JUMP_SLOT T1 0x0
|
|
# PLT-SYM-NEXT: }
|
|
# PLT-SYM-NEXT: ]
|
|
|
|
# PLT-SYM: DynamicSymbols [
|
|
# PLT-SYM-NEXT: Symbol {
|
|
# PLT-SYM-NEXT: Name: @ (0)
|
|
# PLT-SYM-NEXT: Value: 0x0
|
|
# PLT-SYM-NEXT: Size: 0
|
|
# PLT-SYM-NEXT: Binding: Local (0x0)
|
|
# PLT-SYM-NEXT: Type: None (0x0)
|
|
# PLT-SYM-NEXT: Other: 0
|
|
# PLT-SYM-NEXT: Section: Undefined (0x0)
|
|
# PLT-SYM-NEXT: }
|
|
# PLT-SYM-NEXT: Symbol {
|
|
# PLT-SYM-NEXT: Name: D1@ (1)
|
|
# PLT-SYM-NEXT: Value: 0x{{[0-9A-F]+}}
|
|
# PLT-SYM-NEXT: Size: 4
|
|
# PLT-SYM-NEXT: Binding: Global (0x1)
|
|
# PLT-SYM-NEXT: Type: Object (0x1)
|
|
# PLT-SYM-NEXT: Other: 0
|
|
# PLT-SYM-NEXT: Section: .bss
|
|
# PLT-SYM-NEXT: }
|
|
# PLT-SYM-NEXT: Symbol {
|
|
# PLT-SYM-NEXT: Name: T1@ (4)
|
|
# PLT-SYM-NEXT: Value: 0x{{[0-9A-F]+}}
|
|
# PLT-SYM-NEXT: Size: 0
|
|
# PLT-SYM-NEXT: Binding: Global (0x1)
|
|
# PLT-SYM-NEXT: Type: Function (0x2)
|
|
# PLT-SYM-NEXT: Other: 8
|
|
# PLT-SYM-NEXT: Section: Undefined (0x0)
|
|
# PLT-SYM-NEXT: }
|
|
# PLT-SYM-NEXT: Symbol {
|
|
# PLT-SYM-NEXT: Name: T3@ (10)
|
|
# 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)
|
|
# PLT-SYM-NEXT: }
|
|
# PLT-SYM-NEXT: Symbol {
|
|
# PLT-SYM-NEXT: Name: T2@ (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)
|
|
# PLT-SYM-NEXT: }
|
|
# PLT-SYM-NEXT: Symbol {
|
|
# PLT-SYM-NEXT: Name: D2@ (13)
|
|
# PLT-SYM-NEXT: Value: 0x0
|
|
# PLT-SYM-NEXT: Size: 4
|
|
# PLT-SYM-NEXT: Binding: Global (0x1)
|
|
# PLT-SYM-NEXT: Type: Object (0x1)
|
|
# PLT-SYM-NEXT: Other: 0
|
|
# PLT-SYM-NEXT: Section: Undefined (0x0)
|
|
# PLT-SYM-NEXT: }
|
|
# PLT-SYM-NEXT: ]
|
|
|
|
# GOT: Local entries [
|
|
# GOT-NEXT: ]
|
|
# GOT-NEXT: Global entries [
|
|
# GOT-NEXT: Entry {
|
|
# GOT-NEXT: Address: 0x{{[0-9A-F]+}}
|
|
# GOT-NEXT: Access: -32744
|
|
# GOT-NEXT: Initial: 0x0
|
|
# GOT-NEXT: Value: 0x0
|
|
# GOT-NEXT: Type: Function (0x2)
|
|
# GOT-NEXT: Section: Undefined (0x0)
|
|
# GOT-NEXT: Name: T2@ (7)
|
|
# GOT-NEXT: }
|
|
# GOT-NEXT: Entry {
|
|
# GOT-NEXT: Address: 0x{{[0-9A-F]+}}
|
|
# GOT-NEXT: Access: -32740
|
|
# GOT-NEXT: Initial: 0x0
|
|
# GOT-NEXT: Value: 0x0
|
|
# GOT-NEXT: Type: Object (0x1)
|
|
# GOT-NEXT: Section: Undefined (0x0)
|
|
# GOT-NEXT: Name: D2@ (13)
|
|
# GOT-NEXT: }
|
|
# GOT-NEXT: ]
|
|
|
|
# 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_32R6]
|
|
|
|
Sections:
|
|
- Name: .text
|
|
Type: SHT_PROGBITS
|
|
Size: 0x0C
|
|
AddressAlign: 16
|
|
Flags: [SHF_EXECINSTR, SHF_ALLOC]
|
|
|
|
- Name: .data
|
|
Type: SHT_PROGBITS
|
|
Size: 0x08
|
|
AddressAlign: 16
|
|
Flags: [SHF_WRITE, 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
|
|
- Name: T3
|
|
Section: .text
|
|
Type: STT_FUNC
|
|
Value: 0x8
|
|
Size: 4
|
|
- Name: D1
|
|
Section: .data
|
|
Type: STT_OBJECT
|
|
Value: 0x0
|
|
Size: 4
|
|
- Name: D2
|
|
Section: .data
|
|
Type: STT_OBJECT
|
|
Value: 0x4
|
|
Size: 4
|
|
|
|
# o.o
|
|
---
|
|
FileHeader:
|
|
Class: ELFCLASS32
|
|
Data: ELFDATA2LSB
|
|
Type: ET_REL
|
|
Machine: EM_MIPS
|
|
Flags: [EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32R6]
|
|
|
|
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: 0x04
|
|
Symbol: T3
|
|
Type: R_MIPS_26
|
|
|
|
- Name: .rel.data
|
|
Type: SHT_REL
|
|
Info: .data
|
|
AddressAlign: 4
|
|
Relocations:
|
|
- Offset: 0x00
|
|
Symbol: T1
|
|
Type: R_MIPS_PCHI16
|
|
- Offset: 0x00
|
|
Symbol: T1
|
|
Type: R_MIPS_PCLO16
|
|
- Offset: 0x04
|
|
Symbol: T2
|
|
Type: R_MIPS_32
|
|
|
|
- Offset: 0x04
|
|
Symbol: D1
|
|
Type: R_MIPS_PCHI16
|
|
- Offset: 0x04
|
|
Symbol: D1
|
|
Type: R_MIPS_PCLO16
|
|
- Offset: 0x04
|
|
Symbol: D2
|
|
Type: R_MIPS_32
|
|
|
|
Symbols:
|
|
Global:
|
|
- Name: T0
|
|
Section: .text
|
|
Type: STT_FUNC
|
|
Value: 0x0
|
|
Size: 8
|
|
- Name: T1
|
|
Type: STT_FUNC
|
|
- Name: T2
|
|
Type: STT_FUNC
|
|
- Name: T3
|
|
Type: STT_FUNC
|
|
- Name: D0
|
|
Section: .data
|
|
Type: STT_OBJECT
|
|
Value: 0x0
|
|
Size: 8
|
|
- Name: D1
|
|
Type: STT_OBJECT
|
|
- Name: D2
|
|
Type: STT_OBJECT
|
|
...
|