llvm-project/lld/test/old-elf/Mips/rel-dynamic-08-64.test

276 lines
7.0 KiB
Plaintext

# Conditions:
# a) Linking a non-shared executable file.
# b) There ars multiple R_MIPS_64/R_MIPS_HI16/R_MIPS_LO16 relocations
# with various targets.
# Check:
# a) Emitting of R_MIPS_REL32 relocations.
#
# RUN: yaml2obj -format=elf -docnum 1 %s > %t-so.o
# RUN: lld -flavor old-gnu -target mips64el -shared -o %t.so %t-so.o
# RUN: yaml2obj -format=elf -docnum 2 %s > %t-o.o
# RUN: lld -flavor old-gnu -target mips64el -e T0 --noinhibit-exec \
# RUN: -o %t.exe %t-o.o %t.so
# RUN: llvm-readobj -dt -r -sections %t.exe | FileCheck %s
# RUN: llvm-readobj -mips-plt-got %t.exe | FileCheck -check-prefix=GOT %s
# CHECK: Sections [
# CHECK: Section {
# CHECK-NOT: Name: .plt ({{[0-9]+}})
# CHECK: Relocations [
# CHECK-NEXT: Section (5) .rel.dyn {
# CHECK-NEXT: 0x120002000 R_MIPS_REL32/R_MIPS_64/R_MIPS_NONE D2 0x0
# CHECK-NEXT: 0x120002004 R_MIPS_REL32/R_MIPS_64/R_MIPS_NONE T1 0x0
# CHECK-NEXT: 0x120002008 R_MIPS_REL32/R_MIPS_64/R_MIPS_NONE T2 0x0
# CHECK-NEXT: 0x120002008 R_MIPS_REL32/R_MIPS_64/R_MIPS_NONE D1 0x0
# CHECK-NEXT: }
# CHECK-NEXT: ]
# CHECK: DynamicSymbols [
# CHECK-NEXT: Symbol {
# CHECK-NEXT: Name: @ (0)
# CHECK-NEXT: Value: 0x0
# CHECK-NEXT: Size: 0
# CHECK-NEXT: Binding: Local (0x0)
# CHECK-NEXT: Type: None (0x0)
# CHECK-NEXT: Other: 0
# CHECK-NEXT: Section: Undefined (0x0)
# CHECK-NEXT: }
# CHECK-NEXT: Symbol {
# CHECK-NEXT: Name: D2@ (10)
# CHECK-NEXT: Value: 0x0
# CHECK-NEXT: Size: 4
# CHECK-NEXT: Binding: Global (0x1)
# CHECK-NEXT: Type: Object (0x1)
# CHECK-NEXT: Other: 0
# CHECK-NEXT: Section: Undefined (0x0)
# CHECK-NEXT: }
# CHECK-NEXT: Symbol {
# CHECK-NEXT: Name: T1@ (1)
# CHECK-NEXT: Value: 0x0
# CHECK-NEXT: Size: 0
# CHECK-NEXT: Binding: Global (0x1)
# CHECK-NEXT: Type: Function (0x2)
# CHECK-NEXT: Other: 0
# CHECK-NEXT: Section: Undefined (0x0)
# CHECK-NEXT: }
# CHECK-NEXT: Symbol {
# CHECK-NEXT: Name: T2@ (4)
# CHECK-NEXT: Value: 0x0
# CHECK-NEXT: Size: 0
# CHECK-NEXT: Binding: Global (0x1)
# CHECK-NEXT: Type: Function (0x2)
# CHECK-NEXT: Other: 0
# CHECK-NEXT: Section: Undefined (0x0)
# CHECK-NEXT: }
# CHECK-NEXT: Symbol {
# CHECK-NEXT: Name: D1@ (7)
# CHECK-NEXT: Value: 0x0
# CHECK-NEXT: Size: 4
# CHECK-NEXT: Binding: Global (0x1)
# CHECK-NEXT: Type: Object (0x1)
# CHECK-NEXT: Other: 0
# CHECK-NEXT: Section: Undefined (0x0)
# CHECK-NEXT: }
# CHECK-NEXT: ]
# GOT: Local entries [
# GOT-NEXT: ]
# GOT-NEXT: Global entries [
# GOT-NEXT: Entry {
# GOT-NEXT: Address: 0x120001010
# GOT-NEXT: Access: -32736
# GOT-NEXT: Initial: 0x0
# GOT-NEXT: Value: 0x0
# GOT-NEXT: Type: Object (0x1)
# GOT-NEXT: Section: Undefined (0x0)
# GOT-NEXT: Name: D2@ (10)
# GOT-NEXT: }
# GOT-NEXT: Entry {
# GOT-NEXT: Address: 0x120001018
# GOT-NEXT: Access: -32728
# GOT-NEXT: Initial: 0x0
# GOT-NEXT: Value: 0x0
# GOT-NEXT: Type: Function (0x2)
# GOT-NEXT: Section: Undefined (0x0)
# GOT-NEXT: Name: T1@ (1)
# GOT-NEXT: }
# GOT-NEXT: Entry {
# GOT-NEXT: Address: 0x120001020
# GOT-NEXT: Access: -32720
# GOT-NEXT: Initial: 0x0
# GOT-NEXT: Value: 0x0
# GOT-NEXT: Type: Function (0x2)
# GOT-NEXT: Section: Undefined (0x0)
# GOT-NEXT: Name: T2@ (4)
# GOT-NEXT: }
# GOT-NEXT: Entry {
# GOT-NEXT: Address: 0x120001028
# GOT-NEXT: Access: -32712
# GOT-NEXT: Initial: 0x0
# GOT-NEXT: Value: 0x0
# GOT-NEXT: Type: Object (0x1)
# GOT-NEXT: Section: Undefined (0x0)
# GOT-NEXT: Name: D1@ (7)
# GOT-NEXT: }
# GOT-NEXT: ]
# so.o
---
FileHeader:
Class: ELFCLASS64
Data: ELFDATA2LSB
Type: ET_REL
Machine: EM_MIPS
Flags: [EF_MIPS_NOREORDER, EF_MIPS_PIC, EF_MIPS_CPIC, EF_MIPS_ARCH_64]
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: 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: ELFCLASS64
Data: ELFDATA2LSB
Type: ET_REL
Machine: EM_MIPS
Flags: [EF_MIPS_NOREORDER, EF_MIPS_PIC, EF_MIPS_CPIC, EF_MIPS_ARCH_64]
Sections:
- Name: .text
Type: SHT_PROGBITS
Size: 0x0C
AddressAlign: 16
Flags: [SHF_EXECINSTR, SHF_ALLOC]
- Name: .data
Type: SHT_PROGBITS
Size: 0x0C
AddressAlign: 16
Flags: [SHF_WRITE, SHF_ALLOC]
- Name: .rel.text
Type: SHT_RELA
Info: .text
AddressAlign: 4
Relocations:
- Offset: 0x00
Symbol: _gp_disp
Type: R_MIPS_HI16
- Offset: 0x00
Symbol: _gp_disp
Type: R_MIPS_LO16
- Name: .rel.data
Type: SHT_RELA
Info: .data
AddressAlign: 4
Relocations:
- Offset: 0x00 # LT0 is a locally defined function
Symbol: LT0
Type: R_MIPS_64
- Offset: 0x00 # LD0 is a locally defined data object
Symbol: LD0
Type: R_MIPS_64
- Offset: 0x00 # T0 is a defined function
Symbol: T0
Type: R_MIPS_64
- Offset: 0x04 # T1 is a function from shared lib
Symbol: T1
Type: R_MIPS_64
- Offset: 0x08 # T2 has unknown type and defined in shared lib
Symbol: T2
Type: R_MIPS_64
- Offset: 0x00 # T4 is an undefined function
Symbol: T4
Type: R_MIPS_64
- Offset: 0x04 # D0 is a defined data object
Symbol: D0
Type: R_MIPS_64
- Offset: 0x08 # D1 is a data object from shared lib
Symbol: D1
Type: R_MIPS_64
- Offset: 0x00 # D2 has unknown type and defined in shared lib
Symbol: D2
Type: R_MIPS_64
- Offset: 0x04 # D4 is an undefined data object
Symbol: D4
Type: R_MIPS_64
- Offset: 0x08 # U1 is undefined and has unknown type
Symbol: U1
Type: R_MIPS_64
Symbols:
Local:
- Name: LT0
Section: .text
Type: STT_FUNC
Value: 0
Size: 4
- Name: LD0
Section: .data
Type: STT_OBJECT
Value: 0
Size: 4
Global:
- Name: _gp_disp
Type: STT_OBJECT
- Name: T0
Section: .text
Type: STT_FUNC
Value: 0x4
Size: 8
- Name: T1
Type: STT_FUNC
- Name: T2
- Name: T4
Type: STT_FUNC
- Name: D0
Section: .data
Type: STT_OBJECT
Value: 0x4
Size: 8
- Name: D1
Type: STT_OBJECT
- Name: D2
- Name: D4
Type: STT_OBJECT
- Name: U1
...