aboutsummaryrefslogtreecommitdiff
path: root/ld/testsuite/ld-xtensa/tlsbin.s
blob: 2220cfc34fcbd7937a7fa54104b3b06052359f58 (plain)
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
	.section ".tdata", "awT", @progbits
	.global sg1, sg2, sg3, sg4, sg5, sg6, sg7, sg8
	.global sh1, sh2, sh3, sh4, sh5, sh6, sh7, sh8
	.hidden sh1, sh2, sh3, sh4, sh5, sh6, sh7, sh8
	.align	4
sg1:	.long	17
sg2:	.long	18
sg3:	.long	19
sg4:	.long	20
sg5:	.long	21
sg6:	.long	22
sg7:	.long	23
sg8:	.long	24
sl1:	.long	65
sl2:	.long	66
sl3:	.long	67
sl4:	.long	68
sl5:	.long	69
sl6:	.long	70
sl7:	.long	71
sl8:	.long	72
sh1:	.long	157
sh2:	.long	158
sh3:	.long	159
sh4:	.long	160
sh5:	.long	161
sh6:	.long	162
sh7:	.long	163
sh8:	.long	164

	.text
	.global	_start
	.type	_start, @function
_start:
	entry	sp, 32

	/* GD -> IE because variable is not defined in executable */
	movi	a8, sG1@tlsfunc
	movi	a10, sG1@tlsarg
	callx8.tls a8, sG1@tlscall
	
	/* GD -> IE because variable is not defined in executable where
	   the variable is referenced through IE too */
	movi	a8, sG2@tlsfunc
	movi	a10, sG2@tlsarg
	callx8.tls a8, sG2@tlscall

	/* GD -> LE with global variable defined in executable */
	movi	a8, sg1@tlsfunc
	movi	a10, sg1@tlsarg
	callx8.tls a8, sg1@tlscall

	/* GD -> LE with local variable defined in executable */
	movi	a8, sl1@tlsfunc
	movi	a10, sl1@tlsarg
	callx8.tls a8, sl1@tlscall

	/* GD -> LE with hidden variable defined in executable */
	movi	a8, sh1@tlsfunc
	movi	a10, sh1@tlsarg
	callx8.tls a8, sh1@tlscall

	/* LD -> LE */
	movi   a8, _TLS_MODULE_BASE_@tlsfunc
	movi   a10, _TLS_MODULE_BASE_@tlsarg
	callx8.tls a8, _TLS_MODULE_BASE_@tlscall
	movi   a12, 1+sl1@dtpoff
	add    a12, a12, a10
	movi   a13, sl2@dtpoff+2
	add    a13, a13, a10
	
	/* LD -> LE against hidden variables */
	movi   a12, sh1@dtpoff
	add    a12, a12, a10
	movi   a13, 3+sh2@dtpoff
	add    a13, a13, a10

	/* IE against global var */
	rur	a2, THREADPTR
	movi	a3, sG2@tpoff
	add	a3, a3, a2

	/* IE -> LE against global var defined in exec */
	rur	a4, THREADPTR
	movi	a5, sg1@tpoff
	add	a5, a5, a4

	/* IE -> LE against local var */
	rur	a6, THREADPTR
	movi	a7, sl1@tpoff
	add	a7, a7, a6

	/* IE -> LE against hidden var */
	rur	a8, THREADPTR
	movi	a9, sh1@tpoff
	add	a9, a9, a8

	retw