ppc64-tls-ie.s
3.98 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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
# REQUIRES: ppc
# RUN: llvm-mc -filetype=obj -triple=powerpc64le %s -o %t.o
# RUN: llvm-readobj -r %t.o | FileCheck --check-prefix=INPUT-REL %s
## IE
# RUN: ld.lld -shared %t.o -o %t.so
# RUN: llvm-readobj -r %t.so | FileCheck --check-prefix=IE-REL %s
# RUN: llvm-objdump -d --no-show-raw-insn %t.so | FileCheck --check-prefix=IE %s
## IE -> LE
# RUN: ld.lld %t.o -o %t
# RUN: llvm-readelf -r %t | FileCheck --check-prefix=NOREL %s
# RUN: llvm-objdump -d --no-show-raw-insn %t | FileCheck --check-prefix=LE %s
# RUN: llvm-mc -filetype=obj -triple=powerpc64 %s -o %t.o
# RUN: llvm-readobj -r %t.o | FileCheck --check-prefix=INPUT-REL %s
## IE
# RUN: ld.lld -shared %t.o -o %t.so
# RUN: llvm-readobj -r %t.so | FileCheck --check-prefix=IE-REL %s
# RUN: llvm-objdump -d --no-show-raw-insn %t.so | FileCheck --check-prefix=IE %s
## IE -> LE
# RUN: ld.lld %t.o -o %t
# RUN: llvm-readelf -r %t | FileCheck --check-prefix=NOREL %s
# RUN: llvm-objdump -d --no-show-raw-insn %t | FileCheck --check-prefix=LE %s
# IE-REL: .rela.dyn {
# IE-REL-NEXT: 0x204A0 R_PPC64_TPREL64 c 0x0
# IE-REL-NEXT: 0x204B0 R_PPC64_TPREL64 i 0x0
# IE-REL-NEXT: 0x204B8 R_PPC64_TPREL64 l 0x0
# IE-REL-NEXT: 0x204A8 R_PPC64_TPREL64 s 0x0
# IE-REL-NEXT: }
# INPUT-REL: R_PPC64_GOT_TPREL16_HA c 0x0
# INPUT-REL: R_PPC64_GOT_TPREL16_LO_DS c 0x0
# INPUT-REL: R_PPC64_TLS c 0x0
## &.got[0] - .TOC. = -32768
# IE-LABEL: test1:
# IE-NEXT: addis 3, 2, 0
# IE-NEXT: ld 3, -32768(3)
# IE-NEXT: lbzx 3, 3, 13
# LE-LABEL: test1:
# LE-NEXT: nop
# LE-NEXT: addis 3, 13, 0
# LE-NEXT: lbz 3, -28672(3)
test1:
addis 3, 2, c@got@tprel@ha
ld 3, c@got@tprel@l(3)
lbzx 3, 3, c@tls
# INPUT-REL: R_PPC64_GOT_TPREL16_HA s 0x0
# INPUT-REL: R_PPC64_GOT_TPREL16_LO_DS s 0x0
# INPUT-REL: R_PPC64_TLS s 0x0
## &.got[1] - .TOC. = -32760
# IE-LABEL: test2:
# IE-NEXT: addis 3, 2, 0
# IE-NEXT: ld 3, -32760(3)
# IE-NEXT: lhzx 3, 3, 13
# LE-LABEL: test2:
# LE-NEXT: nop
# LE-NEXT: addis 3, 13, 0
# LE-NEXT: lhz 3, -28670(3)
test2:
addis 3, 2, s@got@tprel@ha
ld 3, s@got@tprel@l(3)
lhzx 3, 3, s@tls
# INPUT-REL: R_PPC64_GOT_TPREL16_HA i 0x0
# INPUT-REL: R_PPC64_GOT_TPREL16_LO_DS i 0x0
# INPUT-REL: R_PPC64_TLS i 0x0
## &.got[2] - .TOC. = -32752
# IE-LABEL: test3:
# IE-NEXT: addis 3, 2, 0
# IE-NEXT: ld 3, -32752(3)
# IE-NEXT: lwzx 3, 3, 13
# LE-LABEL: test3:
# LE-NEXT: nop
# LE-NEXT: addis 3, 13, 0
# LE-NEXT: lwz 3, -28668(3)
test3:
addis 3, 2, i@got@tprel@ha
ld 3, i@got@tprel@l(3)
lwzx 3, 3, i@tls
# INPUT-REL: R_PPC64_GOT_TPREL16_HA l 0x0
# INPUT-REL: R_PPC64_GOT_TPREL16_LO_DS l 0x0
# INPUT-REL: R_PPC64_TLS l 0x0
## &.got[3] - .TOC. = -32744
# IE-LABEL: test4:
# IE-NEXT: addis 3, 2, 0
# IE-NEXT: ld 3, -32744(3)
# IE-NEXT: ldx 3, 3, 13
# LE-LABEL: test4:
# LE-NEXT: nop
# LE-NEXT: addis 3, 13, 0
# LE-NEXT: ld 3, -28664(3)
test4:
addis 3, 2, l@got@tprel@ha
ld 3, l@got@tprel@l(3)
ldx 3, 3, l@tls
# LE-LABEL: test5:
# LE-NEXT: nop
# LE-NEXT: addis 4, 13, 0
# LE-NEXT: stb 3, -28672(4)
test5:
addis 4, 2, c@got@tprel@ha
ld 4, c@got@tprel@l(4)
stbx 3, 4, c@tls
# LE-LABEL: test6:
# LE-NEXT: nop
# LE-NEXT: addis 4, 13, 0
# LE-NEXT: sth 3, -28670(4)
test6:
addis 4, 2, s@got@tprel@ha
ld 4, s@got@tprel@l(4)
sthx 3, 4, s@tls
# LE-LABEL: test7:
# LE-NEXT: nop
# LE-NEXT: addis 4, 13, 0
# LE-NEXT: stw 3, -28668(4)
test7:
addis 4, 2, i@got@tprel@ha
ld 4, i@got@tprel@l(4)
stwx 3, 4, i@tls
# LE-LABEL: test8:
# LE-NEXT: nop
# LE-NEXT: addis 4, 13, 0
# LE-NEXT: std 3, -28664(4)
test8:
addis 4, 2, l@got@tprel@ha
ld 4, l@got@tprel@l(4)
stdx 3, 4, l@tls
# LE-LABEL: test9:
# LE-NEXT: nop
# LE-NEXT: addis 3, 13, 0
# LE-NEXT: addi 3, 3, -28668
test9:
addis 3, 2, i@got@tprel@ha
ld 3, i@got@tprel@l(3)
add 3, 3, i@tls
# LE-LABEL: test_ds:
# LE-NEXT: addis 4, 13, 0
# LE-NEXT: std 3, -28664(4)
test_ds:
ld 4, l@got@tprel(2)
stdx 3, 4, l@tls
# NOREL: There are no relocations in this file.
.section .tdata,"awT",@progbits
.globl c, s, i, l
c:
.byte 97
.p2align 1
s:
.short 55
.p2align 2
i:
.long 55
.p2align 3
l:
.quad 55