llvm-project/lld/test/elf/Mips/rel-copy-micro.test

160 lines
3.7 KiB
Plaintext

# Check R_MIPS_COPY relocation emitting
# when linking non-shared executable file.
#
# RUN: yaml2obj -format=elf -docnum 1 %s > %t-so1.o
# RUN: lld -flavor gnu -target mipsel -shared -o %t1.so %t-so1.o
# RUN: yaml2obj -format=elf -docnum 2 %s > %t-so2.o
# RUN: lld -flavor gnu -target mipsel -shared -o %t2.so %t-so2.o
# RUN: yaml2obj -format=elf -docnum 3 %s > %t-o.o
# RUN: lld -flavor gnu -target mipsel -e T0 -o %t.exe %t-o.o %t1.so %t2.so
# RUN: llvm-readobj -dt -r -dynamic-table %t.exe | FileCheck %s
# CHECK: Relocations [
# CHECK-NEXT: Section (5) .rel.dyn {
# CHECK-NEXT: 0x402010 R_MIPS_COPY D1 0x0
# CHECK-NEXT: 0x402018 R_MIPS_COPY D2 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: D1@ (1)
# CHECK-NEXT: Value: 0x402010
# CHECK-NEXT: Size: 8
# CHECK-NEXT: Binding: Global (0x1)
# CHECK-NEXT: Type: Object (0x1)
# CHECK-NEXT: Other: 0
# CHECK-NEXT: Section: .bss (0xA)
# CHECK-NEXT: }
# CHECK-NEXT: Symbol {
# CHECK-NEXT: Name: D2@ (4)
# CHECK-NEXT: Value: 0x402018
# CHECK-NEXT: Size: 4
# CHECK-NEXT: Binding: Global (0x1)
# CHECK-NEXT: Type: Object (0x1)
# CHECK-NEXT: Other: 0
# CHECK-NEXT: Section: .bss (0xA)
# CHECK-NEXT: }
# CHECK-NEXT: ]
# CHECK: DynamicSection [ ({{.*}} entries)
# CHECK: 0x00000001 NEEDED SharedLibrary (rel-copy-micro.test.tmp1.so)
# CHECK: 0x00000001 NEEDED SharedLibrary (rel-copy-micro.test.tmp2.so)
# CHECK-NEXT: 0x00000000 NULL 0x0
# CHECK-NEXT: ]
# so1.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: .data
Type: SHT_PROGBITS
Size: 0x08
AddressAlign: 16
Flags: [SHF_WRITE, SHF_ALLOC]
Symbols:
Global:
- Name: D1
Section: .data
Type: STT_OBJECT
Value: 0x0
Size: 4
# so2.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: .data
Type: SHT_PROGBITS
Size: 0x04
AddressAlign: 16
Flags: [SHF_WRITE, SHF_ALLOC]
Symbols:
Global:
- Name: D2
Section: .data
Type: STT_OBJECT
Value: 0x0
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_32R2, EF_MIPS_MICROMIPS]
Sections:
- Name: .text
Type: SHT_PROGBITS
Size: 0x08
AddressAlign: 16
Flags: [SHF_EXECINSTR, SHF_ALLOC]
- Name: .data
Type: SHT_PROGBITS
Size: 0x0C
AddressAlign: 16
Flags: [SHF_WRITE, SHF_ALLOC]
- Name: .rel.data
Type: SHT_REL
Info: .data
AddressAlign: 4
Relocations:
- Offset: 0x00
Symbol: D1
Type: R_MICROMIPS_HI16
- Offset: 0x00
Symbol: D1
Type: R_MICROMIPS_LO16
- Offset: 0x08
Symbol: D2
Type: R_MICROMIPS_HI16
- Offset: 0x08
Symbol: D2
Type: R_MICROMIPS_LO16
Symbols:
Global:
- Name: T0
Section: .text
Type: STT_FUNC
Value: 0x0
Size: 8
Other: [ STO_MIPS_MICROMIPS ]
- Name: D0
Section: .data
Type: STT_OBJECT
Value: 0x0
Size: 8
- Name: D1
Type: STT_OBJECT
- Name: D2
...