2014-12-25 05:04:05 +08:00
|
|
|
# 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
|
2015-01-26 05:31:52 +08:00
|
|
|
# RUN: llvm-objdump -d -mattr=micromips %t.exe | FileCheck -check-prefix=DIS %s
|
|
|
|
# RUN: llvm-objdump -section-headers %t.exe | FileCheck -check-prefix=EXE %s
|
2014-12-25 05:04:05 +08:00
|
|
|
|
2015-01-26 05:31:52 +08:00
|
|
|
# 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
|
2014-12-25 05:04:05 +08:00
|
|
|
|
|
|
|
# EXE: Sections:
|
|
|
|
# EXE: Idx Name Size Address Type
|
|
|
|
# EXE: 6 .plt 00000024 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
|
2015-03-09 18:53:24 +08:00
|
|
|
Content: '000000000000000000f4000000000000f400000000000000f400000000000000'
|
|
|
|
# jal .text jal glob jal T1
|
2014-12-25 05:04:05 +08:00
|
|
|
- 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
|
|
|
|
...
|