• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2* Copyright (C) 2025 Huawei Device Co., Ltd.
3* Licensed under the Apache License, Version 2.0 (the "License");
4* you may not use this file except in compliance with the License.
5* You may obtain a copy of the License at
6*
7*	http://www.apache.org/licenses/LICENSE-2.0
8*
9* Unless required by applicable law or agreed to in writing, software
10* distributed under the License is distributed on an "AS IS" BASIS,
11* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12* See the License for the specific language governing permissions and
13* limitations under the License.
14*/
15	.text
16
17
18	.globl	tls_tprel64_f1
19	.p2align	2
20	.type	tls_tprel64_f1,@function
21tls_tprel64_f1:
22	sub	sp, sp, #16
23	str	x0, [sp, #8]
24
25	// R_AARCH64_TLS_TPREL64
26	adrp	x9, :gottprel:tls_tprel64_tls_var1
27	ldr	x9, [x9, :gottprel_lo12:tls_tprel64_tls_var1]
28	mrs	x8, TPIDR_EL0
29	ldr	w10, [x8, x9]
30
31	adrp	x9, :got:tls_tprel64_var1
32	ldr	x9, [x9, :got_lo12:tls_tprel64_var1]
33	ldr	w8, [x9]
34	add	w8, w8, w10
35	str	w8, [x9]
36
37	mov	x0, xzr
38	add	sp, sp, #16
39	ret
40.Lfunc_end0:
41	.size	tls_tprel64_f1, .Lfunc_end0-tls_tprel64_f1
42
43
44	.globl	tls_tprel64_test
45	.p2align	2
46	.type	tls_tprel64_test,@function
47tls_tprel64_test:
48	sub	sp, sp, #48
49	stp	x29, x30, [sp, #32]
50	add	x29, sp, #32
51	sub	x0, x29, #8
52	mov	x3, xzr
53	str	x3, [sp, #8]
54	mov	x1, x3
55	adrp	x2, :got:tls_tprel64_f1
56	ldr	x2, [x2, :got_lo12:tls_tprel64_f1]
57	str	x2, [sp]
58	bl	pthread_create
59	ldr	x2, [sp]
60	ldr	x3, [sp, #8]
61	add	x0, sp, #16
62	mov	x1, x3
63	bl	pthread_create
64	ldr	x1, [sp, #8]
65	ldur	x0, [x29, #-8]
66	bl	pthread_join
67	ldr	x1, [sp, #8]
68	ldr	x0, [sp, #16]
69	bl	pthread_join
70	adrp	x8, :got:tls_tprel64_var1
71	ldr	x8, [x8, :got_lo12:tls_tprel64_var1]
72	ldr	w0, [x8]
73	ldp	x29, x30, [sp, #32]
74	add	sp, sp, #48
75	ret
76.Lfunc_end3:
77	.size	tls_tprel64_test, .Lfunc_end3-tls_tprel64_test
78
79
80	.type	tls_tprel64_tls_var1,@object
81	.section	.tdata,"awT",@progbits
82	.globl	tls_tprel64_tls_var1
83	.p2align	2
84tls_tprel64_tls_var1:
85	.word	1
86	.size	tls_tprel64_tls_var1, 4
87
88
89	.type	tls_tprel64_var1,@object
90	.bss
91	.globl	tls_tprel64_var1
92	.p2align	2
93tls_tprel64_var1:
94	.word	0
95	.size	tls_tprel64_var1, 4
96
97
98	.section	".note.GNU-stack","",@progbits
99	.addrsig
100	.addrsig_sym tls_tprel64_f1
101	.addrsig_sym pthread_create
102	.addrsig_sym pthread_join
103	.addrsig_sym tls_tprel64_var1
104