llvm-project/lld/test/elf/Mips/plt-header-micro.test

110 lines
3.2 KiB
Plaintext
Raw Normal View History

# REQUIRES: mips
# Check initialization of .plt header entries
# if all PLT entries use microMIPS encoding.
# 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 glob -o %t.exe %t-o.o %t.so
# RUN: llvm-objdump -section-headers -s %t.exe | \
# RUN: FileCheck -check-prefix=EXE %s
# FIXME (simon): Check the disassembler output when llvm-objdump starts
# to support microMIPS instruction encoding.
# DIS: Disassembly of section .plt:
# DIS: .plt:
# DIS-NEXT: 400170: 7980 07a4 addiu v1,$pc,7824
# DIS-NEXT: 400174: ff23 0000 lw t9,0(v1)
# DIS-NEXT: 400178: 0535 subu v0,v0,v1
# DIS-NEXT: 40017a: 2525 srl v0,v0,2
# DIS-NEXT: 40017c: 3302 fffe addiu t8,v0,-2
# DIS-NEXT: 400180: 0dff move t7,ra
# DIS-NEXT: 400182: 45f9 jalrs t9
# DIS-NEXT: 400184: 0f83 move gp,v1
# DIS-NEXT: 400186: 0c00 nop
# EXE: Sections:
# EXE: Idx Name Size Address Type
# EXE: 6 .plt 00000024 0000000000400170 TEXT DATA
# EXE: 10 .got.plt 0000000c 0000000000402000 DATA
# EXE: Contents of section .plt:
# EXE-NEXT: 400170 8079a407 23ff0000 35052525 0233feff .y..#...5.%%.3..
# EXE-NEXT: 400180 ff0df945 830f000c 0079a007 22ff0000 ...E.....y.."...
# EXE-NEXT: 400190 9945020f
# 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: 0x20
- Name: .rel.text
Type: SHT_REL
Link: .symtab
AddressAlign: 0x04
Info: .text
Relocations:
- Offset: 0x08
Symbol: .text
Type: R_MICROMIPS_26_S1
- Offset: 0x10
Symbol: glob
Type: R_MICROMIPS_26_S1
- Offset: 0x18
Symbol: T1
Type: R_MICROMIPS_26_S1
Symbols:
Local:
- Name: loc
Section: .text
Value: 0x10
Other: [ STO_MIPS_MICROMIPS ]
- Name: .text
Type: STT_SECTION
Section: .text
Global:
- Name: glob
Section: .text
Other: [ STO_MIPS_MICROMIPS ]
- Name: T1
...