mips-npic-call-pic.s
3.67 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
# REQUIRES: mips
# Check LA25 stubs creation. This stub code is necessary when
# non-PIC code calls PIC function.
# RUN: echo "SECTIONS { \
# RUN: . = 0x20000; .text ALIGN(0x100) : { *(.text) *(.text.*) } \
# RUN: }" > %t.script
# RUN: llvm-mc -filetype=obj -triple=mips-unknown-linux -mcpu=mips32r2 \
# RUN: %p/Inputs/mips-fpic.s -o %t-fpic.o
# RUN: llvm-mc -filetype=obj -triple=mips-unknown-linux -mcpu=mips32r2 \
# RUN: %p/Inputs/mips-fnpic.s -o %t-fnpic.o
# RUN: ld.lld -r %t-fpic.o %t-fnpic.o -o %t-sto-pic-r2.o
# RUN: llvm-mc -filetype=obj -triple=mips-unknown-linux -mcpu=mips32r2 \
# RUN: %p/Inputs/mips-pic.s -o %t-pic-r2.o
# RUN: llvm-mc -filetype=obj -triple=mips-unknown-linux -mcpu=mips32r2 \
# RUN: %s -o %t-npic-r2.o
# RUN: ld.lld %t-npic-r2.o %t-pic-r2.o %t-sto-pic-r2.o \
# RUN: -script %t.script -o %t-r2.exe
# RUN: llvm-objdump -d --no-show-raw-insn %t-r2.exe \
# RUN: | FileCheck --check-prefixes=CHECK,R2 %s
# RUN: llvm-mc -filetype=obj -triple=mips-unknown-linux -mcpu=mips32r6 \
# RUN: %p/Inputs/mips-fpic.s -o %t-fpic.o
# RUN: llvm-mc -filetype=obj -triple=mips-unknown-linux -mcpu=mips32r6 \
# RUN: %p/Inputs/mips-fnpic.s -o %t-fnpic.o
# RUN: ld.lld -r %t-fpic.o %t-fnpic.o -o %t-sto-pic-r6.o
# RUN: llvm-mc -filetype=obj -triple=mips-unknown-linux -mcpu=mips32r6 \
# RUN: %p/Inputs/mips-pic.s -o %t-pic-r6.o
# RUN: llvm-mc -filetype=obj -triple=mips-unknown-linux -mcpu=mips32r6 \
# RUN: %s -o %t-npic-r6.o
# RUN: ld.lld %t-npic-r6.o %t-pic-r6.o %t-sto-pic-r6.o \
# RUN: -script %t.script -o %t-r6.exe
# RUN: llvm-objdump -d --no-show-raw-insn %t-r6.exe \
# RUN: | FileCheck --check-prefixes=CHECK,R6 %s
# CHECK: Disassembly of section .text:
# CHECK-EMPTY:
# CHECK-NEXT: __start:
# CHECK-NEXT: 20100: jal 131412 <__LA25Thunk_foo1a>
# CHECK-NEXT: nop
# CHECK-NEXT: jal 131464 <__LA25Thunk_foo2>
# CHECK-NEXT: nop
# CHECK-NEXT: jal 131428 <__LA25Thunk_foo1b>
# CHECK-NEXT: nop
# CHECK-NEXT: jal 131464 <__LA25Thunk_foo2>
# CHECK-NEXT: nop
# CHECK-NEXT: jal 131376 <__LA25Thunk_fpic>
# CHECK-NEXT: nop
# CHECK-NEXT: jal 131408 <fnpic>
# CHECK-NEXT: nop
# CHECK: __LA25Thunk_fpic:
# R2: 20130: lui $25, 2
# R6: 20130: aui $25, $zero, 2
# CHECK-NEXT: j 131392 <fpic>
# CHECK-NEXT: addiu $25, $25, 320
# CHECK-NEXT: nop
# CHECK: fpic:
# CHECK-NEXT: 20140: nop
# CHECK: fnpic:
# CHECK-NEXT: 20150: nop
# CHECK: __LA25Thunk_foo1a:
# R2: 20154: lui $25, 2
# R6: 20154: aui $25, $zero, 2
# CHECK: j 131456 <foo1a>
# CHECK-NEXT: addiu $25, $25, 384
# CHECK-NEXT: nop
# CHECK: __LA25Thunk_foo1b:
# R2: 20164: lui $25, 2
# R6: aui $25, $zero, 2
# CHECK-NEXT: j 131460 <foo1b>
# CHECK-NEXT: addiu $25, $25, 388
# CHECK-NEXT: nop
# CHECK: foo1a:
# CHECK-NEXT: 20180: nop
# CHECK: foo1b:
# CHECK-NEXT: 20184: nop
# CHECK: __LA25Thunk_foo2:
# R2: 20188: lui $25, 2
# R6: aui $25, $zero, 2
# CHECK-NEXT: j 131488 <foo2>
# CHECK-NEXT: addiu $25, $25, 416
# CHECK-NEXT: nop
# CHECK: foo2:
# CHECK-NEXT: 201a0: nop
.text
.globl __start
__start:
jal foo1a
jal foo2
jal foo1b
jal foo2
jal fpic
jal fnpic