forked from OSchip/llvm-project
106 lines
3.2 KiB
Plaintext
106 lines
3.2 KiB
Plaintext
# REQUIRES: mips
|
|
|
|
# Check initialization of .plt header entries if there are both regular
|
|
# and microMIPS encoded PLT entries. Check that R_MIPS_26 and R_MICROMIPS_26_S1
|
|
# relocation with the same target cause generation of two distinct PLT entries.
|
|
|
|
# Build shared library
|
|
# RUN: yaml2obj -format=elf -docnum 1 %s > %t-so.o
|
|
# RUN: lld -flavor gnu -target mipsel -shared -o %t.so %t-so.o
|
|
|
|
# Build executable
|
|
# RUN: yaml2obj -format=elf -docnum 2 %s > %t-o.o
|
|
# RUN: lld -flavor gnu -target mipsel -e globR -o %t.exe %t-o.o %t.so
|
|
# RUN: llvm-objdump -d %t.exe | FileCheck -check-prefix=DIS %s
|
|
# RUN: llvm-objdump -section-headers %t.exe | FileCheck -check-prefix=EXE %s
|
|
|
|
# DIS: Disassembly of section .plt:
|
|
# DIS-NEXT: .plt:
|
|
# DIS-NEXT: 400170: 40 00 1c 3c lui $gp, 64
|
|
# DIS-NEXT: 400174: 00 20 99 8f lw $25, 8192($gp)
|
|
# DIS-NEXT: 400178: 00 20 9c 27 addiu $gp, $gp, 8192
|
|
# DIS-NEXT: 40017c: 23 c0 1c 03 subu $24, $24, $gp
|
|
# DIS-NEXT: 400180: 21 78 e0 03 move $15, $ra
|
|
# DIS-NEXT: 400184: 82 c0 18 00 srl $24, $24, 2
|
|
# DIS-NEXT: 400188: 09 f8 20 03 jalr $25
|
|
# DIS-NEXT: 40018c: fe ff 18 27 addiu $24, $24, -2
|
|
|
|
# DIS-NEXT: 400190: 40 00 0f 3c lui $15, 64
|
|
# DIS-NEXT: 400194: 08 20 f9 8d lw $25, 8200($15)
|
|
# DIS-NEXT: 400198: 08 00 20 03 jr $25
|
|
# DIS-NEXT: 40019c: 08 20 f8 25 addiu $24, $15, 8200
|
|
|
|
# FIXME (simon): Check micromips PLT entry
|
|
# DIS-NEXT: 4001a8: 99 45 02 0f jal 201922148
|
|
|
|
# EXE: Sections:
|
|
# EXE: Idx Name Size Address Type
|
|
# EXE: 6 .plt 0000003c 0000000000400170 TEXT DATA
|
|
# EXE: 10 .got.plt 0000000c 0000000000402000 DATA
|
|
|
|
# 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_32]
|
|
|
|
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
|
|
|
|
# o.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
|
|
Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
|
|
AddressAlign: 0x04
|
|
Size: 0x8
|
|
- Name: .rel.text
|
|
Type: SHT_REL
|
|
Link: .symtab
|
|
AddressAlign: 0x04
|
|
Info: .text
|
|
Relocations:
|
|
- Offset: 0x0
|
|
Symbol: T1
|
|
Type: R_MIPS_26
|
|
- Offset: 0x4
|
|
Symbol: T1
|
|
Type: R_MICROMIPS_26_S1
|
|
|
|
Symbols:
|
|
Global:
|
|
- Name: globR
|
|
Section: .text
|
|
Value: 0x0
|
|
Size: 0x4
|
|
- Name: globM
|
|
Section: .text
|
|
Value: 0x4
|
|
Size: 0x4
|
|
Other: [ STO_MIPS_MICROMIPS ]
|
|
- Name: T1
|
|
...
|