mips-micro-plt.s
1.99 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# REQUIRES: mips
# Check less-significant bit setup for microMIPS PLT.
# RUN: llvm-mc -filetype=obj -triple=mips-unknown-linux \
# RUN: -mattr=micromips %S/Inputs/mips-dynamic.s -o %t-dso.o
# RUN: ld.lld %t-dso.o -shared -soname=t.so -o %t.so
# RUN: llvm-mc -filetype=obj -triple=mips-unknown-linux \
# RUN: -mattr=micromips %s -o %t-exe.o
# RUN: echo "SECTIONS { \
# RUN: . = 0x20000; .text ALIGN(0x100) : { *(.text) } \
# RUN: . = 0x20300; .plt : { *(.plt) } \
# RUN: }" > %t.script
# RUN: ld.lld %t-exe.o %t.so --script %t.script -o %t.exe
# RUN: llvm-readelf --symbols --dyn-syms -A %t.exe | FileCheck %s
# RUN: llvm-objdump -d --mattr=micromips --no-show-raw-insn %t.exe \
# RUN: | FileCheck --check-prefix=ASM %s
# CHECK: Symbol table '.dynsym'
# CHECK: Num: Value Size Type Bind Vis Ndx Name
# CHECK: 1: 00020321 0 FUNC GLOBAL DEFAULT [<other: 0x88>] UND foo0
# CHECK: Symbol table '.symtab'
# CHECK: Num: Value Size Type Bind Vis Ndx Name
# CHECK: 1: 00020210 0 NOTYPE LOCAL HIDDEN [<other: 0x82>] 8 foo
# CHECK: 4: 00020200 0 NOTYPE GLOBAL DEFAULT [<other: 0x80>] 8 __start
# CHECK: 5: 00020320 0 FUNC GLOBAL DEFAULT [<other: 0x88>] UND foo0
# CHECK: Primary GOT:
# CHECK: Local entries:
# CHECK: Address Access Initial
# CHECK: -32744(gp) 00020211
# CHECK: PLT GOT:
# CHECK: Entries:
# CHECK: Address Initial Sym.Val. Type Ndx Name
# CHECK: 00020301 00020321 FUNC UND foo0
# ASM: <__start>:
# ASM-NEXT: 20200: lw $8, -32744($gp)
# ASM-NEXT: addi $8, $8, 529
# ASM-NEXT: lui $8, 2
# ASM-NEXT: addi $8, $8, 801
#
# ASM: <foo>:
# ASM-NEXT: 20210: jal 131872
.text
.set micromips
.global foo
.hidden foo
.global __start
__start:
lw $t0,%got(foo)($gp)
addi $t0,$t0,%lo(foo)
lui $t0,%hi(foo0)
addi $t0,$t0,%lo(foo0)
foo:
jal foo0