1! Test inter-file DataLabel support.
2!
3! We need to test symbols that are:
4! * Global, defined in this file, with/without/both-with-without datalabel
5!   references.
6! * The above in combinations where the reference is/is not from within
7!   the same section.  The implementation is currently indifferent to that
8!   fact, but it seems likely to be something that can change.
9! * Extern with/without/both-with-without datalabel-qualified references.
10! * The above with reference from same *and* other file.
11! * The above in combinations for where the symbol is/is not a
12!   STO_SH5_ISA32-marked symbol.
13
14! There will be omissions and overlap in combinations.  Add spotted
15! omissions with complementary tests in other files.
16
17	.text
18	.mode SHmedia
19
20! For good measure, we start with a nop to get a non-zero offset within
21! the .text section.
22
23	.global start
24start:
25	nop
26
27! Referenced from the same file, same section, is ISA32, only referenced
28! with datalabel qualifier.
29	.global foo
30foo:
31	nop
32	movi (datalabel foo + 8) & 65535,r30
33
34! Referenced from same file, same section, both with and without
35! datalabel qualifier, is ISA32.
36	.global fooboth
37fooboth:
38	nop
39	movi (datalabel fooboth + 16) & 65535,r40
40	movi (fooboth + 12) & 65535,r40
41
42! Same as above, but in different order.
43	.global fooboth2
44fooboth2:
45	nop
46	movi (fooboth2 + 12) & 65535,r40
47	movi (datalabel fooboth2 + 16) & 65535,r40
48
49! Referenced from this file and another, same section, is ISA32.
50	.global foowithout
51foowithout:
52	nop
53	movi (foowithout + 24) & 65535,r30
54
55! Same as above, different section than definition.
56
57	.global foo_other
58foo_other:
59	nop
60	.global foo_otherboth
61foo_otherboth:
62	nop
63	.global foo_otherboth2
64foo_otherboth2:
65	nop
66	.global foo_otherwithout
67foo_otherwithout:
68	nop
69
70	.section .rodata
71	.long datalabel foo_other + 4
72	.long datalabel foo_otherboth + 40
73	.long foo_otherboth + 24
74	.long foo_otherboth2 + 24
75	.long datalabel foo_otherboth2 + 40
76	.long foo_otherwithout
77
78	.text
79
80! Same as above, mixing references from same and other section.
81	.global foo_mix
82foo_mix:
83	nop
84	movi (datalabel foo_mix + 8) & 65535,r30
85	.global foo_mix2
86foo_mix2:
87	nop
88	movi (foo_mix2 + 8) & 65535,r30
89	.global foo_mixboth
90foo_mixboth:
91	nop
92	movi (datalabel foo_mixboth + 80) & 65535,r30
93	movi (foo_mixboth + 80) & 65535,r30
94	.global foo_mixboth2
95foo_mixboth2:
96	nop
97	movi (foo_mixboth2 + 64) & 65535,r30
98	movi (datalabel foo_mixboth2 + 64) & 65535,r30
99	.global foo_mixwithout
100foo_mixwithout:
101	nop
102	movi (foo_mixwithout + 42) & 65535,r30
103	.global foo_mixwithout2
104foo_mixwithout2:
105	nop
106	movi (foo_mixwithout2 + 24) & 65535,r30
107
108	.section .rodata
109	.long foo_mix + 4
110	.long datalabel foo_mix2 + 48
111	.long datalabel foo_mixboth + 400
112	.long foo_mixboth + 420
113	.long foo_mixboth2 + 248
114	.long datalabel foo_mixboth2 + 240
115	.long foo_mixwithout
116
117! Same as above, referencing symbol in other file (reference only from
118! this to other file).
119
120	.text
121	nop
122	movi (datalabel bar + 8) & 65535,r30
123
124	movi (datalabel barboth + 16) & 65535,r40
125	movi (barboth + 12) & 65535,r40
126
127	movi (barboth2 + 12) & 65535,r40
128	movi (datalabel barboth2 + 16) & 65535,r40
129
130	movi (barwithout + 24) & 65535,r30
131
132	.section .rodata
133	.long datalabel bar_other + 4
134	.long datalabel bar_otherboth + 40
135	.long bar_otherboth + 24
136	.long bar_otherboth2 + 24
137	.long datalabel bar_otherboth2 + 40
138	.long bar_otherwithout
139
140	.text
141	movi (datalabel bar_mix + 8) & 65535,r30
142	movi (bar_mix2 + 8) & 65535,r30
143	movi (datalabel bar_mixboth + 80) & 65535,r30
144	movi (bar_mixboth + 80) & 65535,r30
145	movi (bar_mixboth2 + 64) & 65535,r30
146	movi (datalabel bar_mixboth2 + 64) & 65535,r30
147	movi (bar_mixwithout + 42) & 65535,r30
148	movi (bar_mixwithout2 + 24) & 65535,r30
149
150	.section .rodata
151	.long bar_mix + 4
152	.long datalabel bar_mix2 + 48
153	.long datalabel bar_mixboth + 400
154	.long bar_mixboth + 420
155	.long bar_mixboth2 + 248
156	.long datalabel bar_mixboth2 + 240
157	.long bar_mixwithout
158
159! Same as above, referencing symbol in other file *and* within that file.
160
161	.text
162	movi (datalabel baz + 8) & 65535,r30
163
164	movi (datalabel bazboth + 16) & 65535,r40
165	movi (bazboth + 12) & 65535,r40
166
167	movi (bazboth2 + 12) & 65535,r40
168	movi (datalabel bazboth2 + 16) & 65535,r40
169
170	movi (bazwithout + 24) & 65535,r30
171
172	.section .rodata
173	.long datalabel baz_other + 4
174	.long datalabel baz_otherboth + 40
175	.long baz_otherboth + 24
176	.long baz_otherboth2 + 24
177	.long datalabel baz_otherboth2 + 40
178	.long baz_otherwithout
179
180	.text
181	movi (datalabel baz_mix + 8) & 65535,r30
182	movi (baz_mix2 + 8) & 65535,r30
183	movi (datalabel baz_mixboth + 80) & 65535,r30
184	movi (baz_mixboth + 80) & 65535,r30
185	movi (baz_mixboth2 + 64) & 65535,r30
186	movi (datalabel baz_mixboth2 + 64) & 65535,r30
187	movi (baz_mixwithout + 42) & 65535,r30
188	movi (baz_mixwithout2 + 24) & 65535,r30
189
190	.section .rodata
191	.long baz_mix + 4
192	.long datalabel baz_mix2 + 48
193	.long datalabel baz_mixboth + 400
194	.long baz_mixboth + 420
195	.long baz_mixboth2 + 248
196	.long datalabel baz_mixboth2 + 240
197	.long baz_mixwithout
198
199! Same as all of the above, but where the symbol is not an ISA32 one.
200
201	.data
202	.global dfoo
203dfoo:
204	.long 0
205	.long (datalabel dfoo + 8)
206
207	.global dfooboth
208dfooboth:
209	.long 0
210	.long (datalabel dfooboth + 16)
211	.long (dfooboth + 12)
212
213	.global dfooboth2
214dfooboth2:
215	.long 0
216	.long (dfooboth2 + 12)
217	.long (datalabel dfooboth2 + 16)
218
219	.global dfoowithout
220dfoowithout:
221	.long 0
222	.long (dfoowithout + 24)
223
224	.global dfoo_other
225dfoo_other:
226	.long 0
227	.global dfoo_otherboth
228dfoo_otherboth:
229	.long 0
230	.global dfoo_otherboth2
231dfoo_otherboth2:
232	.long 0
233	.global dfoo_otherwithout
234dfoo_otherwithout:
235	.long 0
236
237	.section .rodata
238	.long datalabel dfoo_other + 4
239	.long datalabel dfoo_otherboth + 40
240	.long dfoo_otherboth + 24
241	.long dfoo_otherboth2 + 24
242	.long datalabel dfoo_otherboth2 + 40
243	.long dfoo_otherwithout
244
245	.data
246
247! Same as above, mixing references from same and other section.
248	.global dfoo_mix
249dfoo_mix:
250	.long 0
251	.long (datalabel dfoo_mix + 8)
252	.global dfoo_mix2
253dfoo_mix2:
254	.long 0
255	.long (dfoo_mix2 + 8)
256	.global dfoo_mixboth
257dfoo_mixboth:
258	.long 0
259	.long (datalabel dfoo_mixboth + 80)
260	.long (dfoo_mixboth + 80)
261	.global dfoo_mixboth2
262dfoo_mixboth2:
263	.long 0
264	.long (dfoo_mixboth2 + 64)
265	.long (datalabel dfoo_mixboth2 + 64)
266	.global dfoo_mixwithout
267dfoo_mixwithout:
268	.long 0
269	.long (dfoo_mixwithout + 42)
270	.global dfoo_mixwithout2
271dfoo_mixwithout2:
272	.long 0
273	.long (dfoo_mixwithout2 + 24)
274
275	.section .rodata
276	.long dfoo_mix + 4
277	.long datalabel dfoo_mix2 + 48
278	.long datalabel dfoo_mixboth + 400
279	.long dfoo_mixboth + 420
280	.long dfoo_mixboth2 + 248
281	.long datalabel dfoo_mixboth2 + 240
282	.long dfoo_mixwithout
283
284! Same as above, referencing symbol in other file (reference only from
285! this to other file).
286
287	.text
288	movi (datalabel dbarboth + 16) & 65535,r40
289	movi (dbarboth + 12) & 65535,r40
290	movi (dbarboth2 + 12) & 65535,r40
291	movi (datalabel dbarboth2 + 16) & 65535,r40
292	movi (dbarwithout + 24) & 65535,r30
293
294	.data
295	.long (datalabel dbar + 8)
296	.long datalabel dbar_other + 4
297	.long datalabel dbar_otherboth + 40
298	.long dbar_otherboth + 24
299	.long dbar_otherboth2 + 24
300	.long datalabel dbar_otherboth2 + 40
301	.long dbar_otherwithout
302
303	.text
304	movi (datalabel dbar_mix + 8) & 65535,r30
305	movi (dbar_mix2 + 8) & 65535,r30
306	movi (datalabel dbar_mixboth + 80) & 65535,r30
307	movi (dbar_mixboth + 80) & 65535,r30
308	movi (dbar_mixboth2 + 64) & 65535,r30
309	movi (datalabel dbar_mixboth2 + 64) & 65535,r30
310	movi (dbar_mixwithout + 42) & 65535,r30
311	movi (dbar_mixwithout2 + 24) & 65535,r30
312
313	.data
314	.long dbar_mix + 4
315	.long datalabel dbar_mix2 + 48
316	.long datalabel dbar_mixboth + 400
317	.long dbar_mixboth + 420
318	.long dbar_mixboth2 + 248
319	.long datalabel dbar_mixboth2 + 240
320	.long dbar_mixwithout
321
322! Same as above, referencing symbol in other file *and* within that file.
323
324	.text
325	movi (datalabel dbazboth + 16) & 65535,r40
326	movi (dbazboth + 12) & 65535,r40
327
328	movi (dbazboth2 + 12) & 65535,r40
329	movi (datalabel dbazboth2 + 16) & 65535,r40
330
331	movi (dbazwithout + 24) & 65535,r30
332
333	.data
334	.long (datalabel dbaz + 8)
335	.long datalabel dbaz_other + 4
336	.long datalabel dbaz_otherboth + 40
337	.long dbaz_otherboth + 24
338	.long dbaz_otherboth2 + 24
339	.long datalabel dbaz_otherboth2 + 40
340	.long dbaz_otherwithout
341
342	.text
343	movi (datalabel dbaz_mix + 8) & 65535,r30
344	movi (dbaz_mix2 + 8) & 65535,r30
345	movi (datalabel dbaz_mixboth + 80) & 65535,r30
346	movi (dbaz_mixboth + 80) & 65535,r30
347	movi (dbaz_mixboth2 + 64) & 65535,r30
348	movi (datalabel dbaz_mixboth2 + 64) & 65535,r30
349	movi (dbaz_mixwithout + 42) & 65535,r30
350	movi (dbaz_mixwithout2 + 24) & 65535,r30
351
352	.data
353	.long dbaz_mix + 4
354	.long datalabel dbaz_mix2 + 48
355	.long datalabel dbaz_mixboth + 400
356	.long dbaz_mixboth + 420
357	.long dbaz_mixboth2 + 248
358	.long datalabel dbaz_mixboth2 + 240
359	.long dbaz_mixwithout
360