llvm-project/lld/test/elf/Mips/rel-dynamic-03-micro.test

125 lines
3.0 KiB
Plaintext
Raw Normal View History

# REQUIRES: mips
# Conditions:
# a) Linking a non-shared executable file.
# b) Relocations' target is a symbol defined in the shared object.
# c) The target symbol is referenced by both branch (R_MICROMIPS_26_S1)
# and regular (R_MIPS_32) relocations.
# Check:
# a) There should be no R_MIPS_REL32 relocation.
# b) Linker creates a single PLT entry.
# c) 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 gnu -target mipsel -shared -o %t.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.so
# RUN: llvm-objdump -s %t.exe | FileCheck -check-prefix=DIS %s
# RUN: llvm-readobj -dt -r %t.exe | FileCheck -check-prefix=PLT-SYM %s
# FIXME (simon): Check the disassembler output when llvm-objdump starts
# to support microMIPS instruction encoding.
# DIS: Contents of section .plt:
# DIS-NEXT: 400170 8079a407 23ff0000 35052525 0233feff .y..#...5.%%.3..
# DIS-NEXT: 400180 ff0df945 830f000c 0079a007 22ff0000 ...E.....y.."...
# DIS-NEXT: 400190 9945020f .E..
# PLT-SYM: Relocations [
# PLT-SYM-NEXT: Section (5) .rel.plt {
# PLT-SYM-NEXT: 0x402008 R_MIPS_JUMP_SLOT T1 0x0
# PLT-SYM-NEXT: }
# PLT-SYM-NEXT: ]
# PLT-SYM: Name: T1@ (1)
# PLT-SYM-NEXT: Value: 0x400189
# 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)
# 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_32R2, EF_MIPS_MICROMIPS]
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
Other: [ STO_MIPS_MICROMIPS ]
# o.o
---
FileHeader: !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: 0x08
AddressAlign: 16
Flags: [SHF_WRITE, SHF_ALLOC]
- Name: .rel.text
Type: SHT_REL
Info: .text
AddressAlign: 4
Relocations:
- Offset: 0x04
Symbol: T1
Type: R_MICROMIPS_26_S1
- Name: .rel.data
Type: SHT_REL
Info: .data
AddressAlign: 4
Relocations:
- Offset: 0x04
Symbol: T1
Type: R_MIPS_32
Symbols:
Global:
- Name: T0
Section: .text
Type: STT_FUNC
Value: 0x0
Size: 8
Other: [ STO_MIPS_MICROMIPS ]
- Name: T1
Type: STT_FUNC
- Name: D0
Section: .data
Type: STT_OBJECT
Value: 0x0
Size: 8
...