forked from OSchip/llvm-project
134 lines
3.4 KiB
Plaintext
134 lines
3.4 KiB
Plaintext
# 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 -d -mattr=micromips %t.exe | FileCheck -check-prefix=DIS %s
|
|
# RUN: llvm-readobj -dt -r %t.exe | FileCheck -check-prefix=PLT-SYM %s
|
|
|
|
# DIS: Disassembly of section .plt:
|
|
# DIS-NEXT: .plt:
|
|
# DIS-NEXT: 400170: 80 79 a4 07 addiupc $3, 7824
|
|
# DIS-NEXT: 400174: 23 ff 00 00 lw $25, 0($3)
|
|
# DIS-NEXT: 400178: 35 05 subu16 $2, $2, $3
|
|
# DIS-NEXT: 40017a: 25 25 srl16 $2, $2, 2
|
|
# DIS-NEXT: 40017c: 02 33 fe ff addiu $24, $2, -2
|
|
# DIS-NEXT: 400180: ff 0d move $15, $ra
|
|
# DIS-NEXT: 400182: f9 45 jalrs16 $25
|
|
# DIS-NEXT: 400184: 83 0f move $gp, $3
|
|
# DIS-NEXT: 400186: 00 0c nop
|
|
|
|
# DIS-NEXT: 400188: 00 79 a0 07 addiupc $2, 7808
|
|
# DIS-NEXT: 40018c: 22 ff 00 00 lw $25, 0($2)
|
|
# DIS-NEXT: 400190: 99 45 jr16 $25
|
|
# DIS-NEXT: 400192: 02 0f move $24, $2
|
|
|
|
# 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
|
|
...
|