summaryrefslogtreecommitdiffstats
path: root/ld/testsuite/ld-arm/group-relocs.s
blob: 7b226c72889646a5d58fc6a48d249cad0a886bfe (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
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
@ Tests for group relocations.
@
@ Beware when editing this file: it is carefully crafted so that
@ specific PC- and SB-relative offsets arise.
@
@ Note that the gas tests have already checked that group relocations are
@ handled in the same way for local and external symbols.

@ We will place .text at 0x8000.

	.text
	.globl _start

_start:
	@ ALU, PC-relative

	@ Instructions start at .text + 0x0
	add	r0, r15, #:pc_g0:(one_group_needed_alu_pc)

	@ Instructions start at .text + 0x4
	add	r0, r15, #:pc_g0_nc:(two_groups_needed_alu_pc)
	add	r0, r0, #:pc_g1:(two_groups_needed_alu_pc + 4)

	@ Instructions start at .text + 0xc
	add	r0, r15, #:pc_g0_nc:(three_groups_needed_alu_pc)
	add	r0, r0, #:pc_g1_nc:(three_groups_needed_alu_pc + 4)
	add	r0, r0, #:pc_g2:(three_groups_needed_alu_pc + 8)

	@ ALU, SB-relative

	@ Instructions start at .text + 0x18
	add	r0, r0, #:sb_g0:(one_group_needed_alu_sb)

	@ Instructions start at .text + 0x1c
	add	r0, r0, #:sb_g0_nc:(two_groups_needed_alu_sb)
	add	r0, r0, #:sb_g1:(two_groups_needed_alu_sb)

	@ Instructions start at .text + 0x24
	add	r0, r0, #:sb_g0_nc:(three_groups_needed_alu_sb)
	add	r0, r0, #:sb_g1_nc:(three_groups_needed_alu_sb)
	add	r0, r0, #:sb_g2:(three_groups_needed_alu_sb)

	@ LDR, PC-relative

	@ Instructions start at .text + 0x30
	add	r0, pc, #:pc_g0_nc:(two_groups_needed_ldr_pc)
	ldr	r1, [r0, #:pc_g1:(two_groups_needed_ldr_pc + 4)]

	@ Instructions start at .text + 0x38
	add	r0, pc, #:pc_g0_nc:(three_groups_needed_ldr_pc)
	add	r0, r0, #:pc_g1_nc:(three_groups_needed_ldr_pc + 4)
	ldr	r1, [r0, #:pc_g2:(three_groups_needed_ldr_pc + 8)]

	@ LDR, SB-relative

	@ Instructions start at .text + 0x44
	ldr	r1, [r0, #:sb_g0:(one_group_needed_ldr_sb)]

	@ Instructions start at .text + 0x48
	add	r0, r0, #:sb_g0_nc:(two_groups_needed_ldr_sb)
	ldr	r1, [r0, #:sb_g1:(two_groups_needed_ldr_sb)]

	@ Instructions start at .text + 0x50
	add	r0, r0, #:sb_g0_nc:(three_groups_needed_ldr_sb)
	add	r0, r0, #:sb_g1_nc:(three_groups_needed_ldr_sb)
	ldr	r1, [r0, #:sb_g2:(three_groups_needed_ldr_sb)]

	@ LDRS, PC-relative

	@ Instructions start at .text + 0x5c
	ldrd	r2, [pc, #:pc_g0:(one_group_needed_ldrs_pc)]

	@ Instructions start at .text + 0x60
	add	r0, pc, #:pc_g0_nc:(two_groups_needed_ldrs_pc)
	ldrd	r2, [r0, #:pc_g1:(two_groups_needed_ldrs_pc + 4)]

	@ Instructions start at .text + 0x68
	add	r0, pc, #:pc_g0_nc:(three_groups_needed_ldrs_pc)
	add	r0, r0, #:pc_g1_nc:(three_groups_needed_ldrs_pc + 4)
	ldrd	r2, [r0, #:pc_g2:(three_groups_needed_ldrs_pc + 8)]

	@ LDRS, SB-relative

	@ Instructions start at .text + 0x74
	ldrd	r2, [r0, #:sb_g0:(one_group_needed_ldrs_sb)]

	@ Instructions start at .text + 0x78
	add	r0, r0, #:sb_g0_nc:(two_groups_needed_ldrs_sb)
	ldrd	r2, [r0, #:sb_g1:(two_groups_needed_ldrs_sb)]

	@ Instructions start at .text + 0x80
	add	r0, r0, #:sb_g0_nc:(three_groups_needed_ldrs_sb)
	add	r0, r0, #:sb_g1_nc:(three_groups_needed_ldrs_sb)
	ldrd	r2, [r0, #:sb_g2:(three_groups_needed_ldrs_sb)]

	@ LDC, PC-relative

	@ Instructions start at .text + 0x8c
	ldc	0, c0, [pc, #:pc_g0:(one_group_needed_ldc_pc)]

	@ Instructions start at .text + 0x90
	add	r0, pc, #:pc_g0_nc:(two_groups_needed_ldc_pc)
	ldc	0, c0, [r0, #:pc_g1:(two_groups_needed_ldc_pc + 4)]

	@ Instructions start at .text + 0x98
	add	r0, pc, #:pc_g0_nc:(three_groups_needed_ldc_pc)
	add	r0, r0, #:pc_g1_nc:(three_groups_needed_ldc_pc + 4)
	ldc	0, c0, [r0, #:pc_g2:(three_groups_needed_ldc_pc + 8)]

	@ LDC, SB-relative

	@ Instructions start at .text + 0xa4
	ldc	0, c0, [r0, #:sb_g0:(one_group_needed_ldc_sb)]

	@ Instructions start at .text + 0xa8
	add	r0, r0, #:sb_g0_nc:(two_groups_needed_ldc_sb)
	ldc	0, c0, [r0, #:sb_g1:(two_groups_needed_ldc_sb)]

	@ Instructions start at .text + 0xb0
	add	r0, r0, #:sb_g0_nc:(three_groups_needed_ldc_sb)
	add	r0, r0, #:sb_g1_nc:(three_groups_needed_ldc_sb)
	ldc	0, c0, [r0, #:sb_g2:(three_groups_needed_ldc_sb)]

@ This point in the file is .text + 0xbc.

one_group_needed_alu_pc:
one_group_needed_ldrs_pc:
one_group_needed_ldc_pc:
	mov	r0, #0

@ We will place the section .data at 0x03000000

	.data

	.word 0, 0, 0
one_group_needed_alu_sb:
one_group_needed_ldr_sb:
one_group_needed_ldrs_sb:
one_group_needed_ldc_sb:
	.word 1				@ Offset 0xc
	.fill 0xeef0 - 16, 1, 0
two_groups_needed_alu_sb:
two_groups_needed_ldr_sb:
two_groups_needed_ldrs_sb:
two_groups_needed_ldc_sb:
	.word 2				@ Offset 0xeef0
	.fill 0xffeef0 - 0xeef0 - 4, 1, 0
three_groups_needed_alu_sb:
three_groups_needed_ldr_sb:
three_groups_needed_ldrs_sb:
three_groups_needed_ldc_sb:
	.word 3				@ Offset 0xffeef0

@ We will place the section alpha at 0xeef0.

	.section alpha, "x"

two_groups_needed_alu_pc:
two_groups_needed_ldr_pc:
two_groups_needed_ldrs_pc:
two_groups_needed_ldc_pc:
	mov	r0, #0

@ We will place the section beta at 0xffeef0.

	.section beta, "x"

three_groups_needed_alu_pc:
three_groups_needed_ldr_pc:
three_groups_needed_ldrs_pc:
three_groups_needed_ldc_pc:
	mov	r0, #0

OpenPOWER on IntegriCloud