• 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	relative_test
19	.p2align	2
20	.type	relative_test,@function
21relative_test:
22	adrp	x8, :got:relative_var1
23	ldr	x8, [x8, :got_lo12:relative_var1]
24	ldr	w8, [x8]
25
26	adrp	x10, :got:relative_struct1
27	ldr	x10, [x10, :got_lo12:relative_struct1]
28	ldr	x9, [x10]
29	ldr	w9, [x9]
30	ldr	x10, [x10, #8]
31	ldr	w10, [x10]
32
33	adrp	x12, :got:relative_struct2
34	ldr	x12, [x12, :got_lo12:relative_struct2]
35	ldr	x11, [x12]
36	ldr	w11, [x11]
37	ldr	x12, [x12, #8]
38	ldr	w12, [x12]
39
40	add	w8, w8, w9
41	add	w8, w8, w10
42	add	w8, w8, w11
43	add	w0, w8, w12
44	ret
45.Lfunc_end0:
46	.size	relative_test, .Lfunc_end0-relative_test
47
48
49	.type	relative_var1,@object
50	.data
51	.p2align	2
52relative_var1:
53	.word	1
54	.size	relative_var1, 4
55
56
57	.type	_ZL17relative_var1_tmp,@object
58	.p2align	2
59_ZL17relative_var1_tmp:
60	.word	1
61	.size	_ZL17relative_var1_tmp, 4
62
63
64	.type	_ZL17relative_var2_tmp,@object
65	.p2align	2
66_ZL17relative_var2_tmp:
67	.word	1
68	.size	_ZL17relative_var2_tmp, 4
69
70
71	.type	relative_struct1,@object
72	.globl	relative_struct1
73	.p2align	3
74relative_struct1:
75	.xword	_ZL17relative_var1_tmp
76	.xword	_ZL17relative_var2_tmp
77	.size	relative_struct1, 16
78
79
80	.type	relative_struct2,@object
81	.globl	relative_struct2
82	.p2align	3
83relative_struct2:
84	.quad	_ZL17relative_var1_tmp
85	.quad	_ZL17relative_var2_tmp
86	.size	relative_struct2, 16
87
88
89	.section	".note.GNU-stack","",@progbits
90	.addrsig
91	.addrsig_sym relative_var1
92	.addrsig_sym _ZL17relative_var1_tmp
93	.addrsig_sym _ZL17relative_var2_tmp
94	.addrsig_sym relative_struct1
95	.addrsig_sym relative_struct2
96