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
|
.data
.section .tdata,"awT",@progbits
.global gl1, gl2, gl3, gl4
.global hd1, hd2
.hidden hd1, hd2
gl1: .dword 1
gl2: .dword 2
gl3: .dword 3
gl4: .dword 4
lo1: .dword 10
lo2: .dword 20
lo3: .dword 30
lo4: .dword 40
hd1: .dword 100
hd2: .dword 200
.text
# Access global symbol
fun_gl1:
# GD + IE
# GD: pcaddi + addi.d => pcaddi
la.tls.gd $a0, gl1
la.tls.ie $a0, gl1
# GD + DESC
# GD: pcaddi + addi.d => pcaddi
la.tls.gd $a0, gl2
# DESC: pcaddi + addi.d => pcaddi
la.tls.desc $a0, gl2
# DESC + IE
# DESC -> IE
la.tls.desc $a0, gl3
la.tls.ie $a0, gl3
# GD + DESC + IE
# GD: pcaddi + addi.d => pcaddi
la.tls.gd $a0, gl4
# DESC: pcaddi + addi.d => pcaddi
la.tls.desc $a0, gl4
la.tls.ie $a0, gl4
# Access local symbol
fun_lo:
# IE + GD
la.tls.ie $a0, lo1
# GD: pcaddi + addi.d => pcaddi
la.tls.gd $a0, lo1
# DESC + GD
# DESC: pcaddi + addi.d => pcaddi
la.tls.desc $a0, lo2
# GD: pcaddi + addi.d => pcaddi
la.tls.gd $a0, lo2
# DESC + IE
# DESC: DESC -> IE
la.tls.desc $a0, lo3
la.tls.ie $a0, lo3
# DESC + GD + IE
# DESC: pcaddi + addi.d => pcaddi
la.tls.desc $a0, lo4
# GD: pcaddi + addi.d => pcaddi
la.tls.gd $a0, lo4
la.tls.ie $a0, lo4
# Access external undef symbol
fun_external:
la.tls.desc $a0, sH1
# Access hidden symbol
fun_hidden:
la.tls.desc $a0, hd1
la.tls.desc $a0, hd2
|