tls-ld-v2-abi.s
4.81 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
172
173
174
175
176
177
// RUN: llvm-mc -triple=powerpc64le-pc-linux -filetype=obj %s -o - | \
// RUN: llvm-readobj -r - | FileCheck %s
// RUN: llvm-mc -triple=powerpc64-pc-linux -filetype=obj %s -o - | \
// RUN: llvm-readobj -r - | FileCheck %s
// Verify we can handle all the dtprel symbol modifiers for local-dynamic tls.
// Tests a 16 bit offset on both DS-form and D-form instructions, 32 bit
// adjusted and non-adjusted offsets, and 64 bit adjusted and non-adjusted
// offsets.
.text
.abiversion 2
.globl short_offset
.p2align 4
.type short_offset,@function
short_offset:
.Lfunc_gep0:
addis 2, 12, .TOC.-.Lfunc_gep0@ha
addi 2, 2, .TOC.-.Lfunc_gep0@l
.Lfunc_lep0:
.localentry short_offset, .Lfunc_lep0-.Lfunc_gep0
mflr 0
std 0, 16(1)
stdu 1, -32(1)
addis 3, 2, i@got@tlsld@ha
addi 3, 3, i@got@tlsld@l
bl __tls_get_addr(i@tlsld)
nop
lwa 4, i@dtprel(3)
addi 5, 3, i@dtprel
lwa 3, 0(5)
add 3, 4, 3
addi 1, 1, 32
ld 0, 16(1)
mtlr 0
blr
.globl medium_offset
.p2align 4
.type medium_offset,@function
medium_offset:
.Lfunc_gep1:
addis 2, 12, .TOC.-.Lfunc_gep1@ha
addi 2, 2, .TOC.-.Lfunc_gep1@l
.Lfunc_lep1:
.localentry medium_offset, .Lfunc_lep1-.Lfunc_gep1
mflr 0
std 0, 16(1)
stdu 1, -32(1)
addis 3, 2, i@got@tlsld@ha
addi 3, 3, i@got@tlsld@l
bl __tls_get_addr(i@tlsld)
nop
addis 3, 3, i@dtprel@ha
lwa 3, i@dtprel@l(3)
addi 1, 1, 32
ld 0, 16(1)
mtlr 0
blr
.globl medium_not_adjusted
.p2align 4
.type medium_not_adjusted,@function
medium_not_adjusted:
.Lfunc_gep2:
addis 2, 12, .TOC.-.Lfunc_gep2@ha
addi 2, 2, .TOC.-.Lfunc_gep2@l
.Lfunc_lep2:
.localentry medium_not_adjusted, .Lfunc_lep2-.Lfunc_gep2
mflr 0
std 0, 16(1)
stdu 1, -32(1)
addis 3, 2, i@got@tlsld@ha
addi 3, 3, i@got@tlsld@l
bl __tls_get_addr(i@tlsld)
nop
lis 4, i@dtprel@h
ori 4, 4, i@dtprel@l
add 3, 3, 4
addi 1, 1, 32
ld 0, 16(1)
mtlr 0
blr
.globl large_offset
.p2align 4
.type large_offset,@function
large_offset:
.Lfunc_gep3:
addis 2, 12, .TOC.-.Lfunc_gep3@ha
addi 2, 2, .TOC.-.Lfunc_gep3@l
.Lfunc_lep3:
.localentry large_offset, .Lfunc_lep3-.Lfunc_gep3
mflr 0
std 0, 16(1)
stdu 1, -32(1)
addis 3, 2, i@got@tlsld@ha
addi 3, 3, i@got@tlsld@l
bl __tls_get_addr(i@tlsld)
nop
lis 4, i@dtprel@highesta
ori 4, 4, i@dtprel@highera
sldi 4, 4, 32
addis 4, 4, i@dtprel@higha
addi 4, 4, i@dtprel@l
lwax 3, 4, 3
addi 1, 1, 32
ld 0, 16(1)
mtlr 0
blr
.globl not_adjusted
.p2align 4
.type not_adjusted,@function
not_adjusted:
.Lfunc_gep4:
addis 2, 12, .TOC.-.Lfunc_gep4@ha
addi 2, 2, .TOC.-.Lfunc_gep4@l
.Lfunc_lep4:
.localentry not_adjusted, .Lfunc_lep4-.Lfunc_gep4
mflr 0
std 0, 16(1)
stdu 1, -32(1)
addis 3, 2, i@got@tlsld@ha
addi 3, 3, i@got@tlsld@l
bl __tls_get_addr(i@tlsld)
nop
lis 4, i@dtprel@highest
ori 4, 4, i@dtprel@higher
sldi 4, 4, 32
oris 4, 4, i@dtprel@high
ori 4, 4, i@dtprel@l
lwax 3, 4, 3
addi 1, 1, 32
ld 0, 16(1)
mtlr 0
blr
.type i,@object
.section .tdata,"awT",@progbits
.p2align 2
i:
.long 55
.size i, 4
.type j,@object
.data
.p2align 3
j:
.quad i@dtprel
.size j, 8
# CHECK: Relocations [
# CHECK: Section {{.*}} .rela.text {
# CHECK: 0x{{[0-9A-F]+}} R_PPC64_GOT_TLSLD16_HA i
# CHECK: 0x{{[0-9A-F]+}} R_PPC64_GOT_TLSLD16_LO i
# CHECK: 0x{{[0-9A-F]+}} R_PPC64_TLSLD i
# CHECK: 0x{{[0-9A-F]+}} R_PPC64_REL24 __tls_get_addr
# CHECK: 0x{{[0-9A-F]+}} R_PPC64_DTPREL16_DS i
# CHECK: 0x{{[0-9A-F]+}} R_PPC64_DTPREL16 i
# CHECK: 0x{{[0-9A-F]+}} R_PPC64_DTPREL16_HA i
# CHECK: 0x{{[0-9A-F]+}} R_PPC64_DTPREL16_LO_DS i
# CHECK: 0x{{[0-9A-F]+}} R_PPC64_DTPREL16_HI i
# CHECK: 0x{{[0-9A-F]+}} R_PPC64_DTPREL16_HIGHESTA i
# CHECK: 0x{{[0-9A-F]+}} R_PPC64_DTPREL16_HIGHERA i
# CHECK: 0x{{[0-9A-F]+}} R_PPC64_DTPREL16_HIGHA i
# CHECK: 0x{{[0-9A-F]+}} R_PPC64_DTPREL16_LO i
# CHECK: 0x{{[0-9A-F]+}} R_PPC64_DTPREL16_HIGHEST i
# CHECK: 0x{{[0-9A-F]+}} R_PPC64_DTPREL16_HIGHER i
# CHECK: 0x{{[0-9A-F]+}} R_PPC64_DTPREL16_HIGH i
# CHECK: 0x{{[0-9A-F]+}} R_PPC64_DTPREL16_LO i
# CHECK: }
# CHECK: Section {{.*}} .rela.data {
# CHECK: 0x{{[0-9A-F]+}} R_PPC64_DTPREL64 i
# CHECK: }
# CHECK: ]