* elf32-m32c.c (m32c_offset_for_reloc): Fix local symbol
[binutils.git] / ld / testsuite / ld-sh / sh64 / shdl-1.s
blob0f2803c946df5556255f0913b77269bc28d9bf6b
1 ! Test inter-file DataLabel support.
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.
14 ! There will be omissions and overlap in combinations. Add spotted
15 ! omissions with complementary tests in other files.
17 .text
18 .mode SHmedia
20 ! For good measure, we start with a nop to get a non-zero offset within
21 ! the .text section.
23 .global start
24 start:
25 nop
27 ! Referenced from the same file, same section, is ISA32, only referenced
28 ! with datalabel qualifier.
29 .global foo
30 foo:
31 nop
32 movi (datalabel foo + 8) & 65535,r30
34 ! Referenced from same file, same section, both with and without
35 ! datalabel qualifier, is ISA32.
36 .global fooboth
37 fooboth:
38 nop
39 movi (datalabel fooboth + 16) & 65535,r40
40 movi (fooboth + 12) & 65535,r40
42 ! Same as above, but in different order.
43 .global fooboth2
44 fooboth2:
45 nop
46 movi (fooboth2 + 12) & 65535,r40
47 movi (datalabel fooboth2 + 16) & 65535,r40
49 ! Referenced from this file and another, same section, is ISA32.
50 .global foowithout
51 foowithout:
52 nop
53 movi (foowithout + 24) & 65535,r30
55 ! Same as above, different section than definition.
57 .global foo_other
58 foo_other:
59 nop
60 .global foo_otherboth
61 foo_otherboth:
62 nop
63 .global foo_otherboth2
64 foo_otherboth2:
65 nop
66 .global foo_otherwithout
67 foo_otherwithout:
68 nop
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
78 .text
80 ! Same as above, mixing references from same and other section.
81 .global foo_mix
82 foo_mix:
83 nop
84 movi (datalabel foo_mix + 8) & 65535,r30
85 .global foo_mix2
86 foo_mix2:
87 nop
88 movi (foo_mix2 + 8) & 65535,r30
89 .global foo_mixboth
90 foo_mixboth:
91 nop
92 movi (datalabel foo_mixboth + 80) & 65535,r30
93 movi (foo_mixboth + 80) & 65535,r30
94 .global foo_mixboth2
95 foo_mixboth2:
96 nop
97 movi (foo_mixboth2 + 64) & 65535,r30
98 movi (datalabel foo_mixboth2 + 64) & 65535,r30
99 .global foo_mixwithout
100 foo_mixwithout:
102 movi (foo_mixwithout + 42) & 65535,r30
103 .global foo_mixwithout2
104 foo_mixwithout2:
106 movi (foo_mixwithout2 + 24) & 65535,r30
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
117 ! Same as above, referencing symbol in other file (reference only from
118 ! this to other file).
120 .text
122 movi (datalabel bar + 8) & 65535,r30
124 movi (datalabel barboth + 16) & 65535,r40
125 movi (barboth + 12) & 65535,r40
127 movi (barboth2 + 12) & 65535,r40
128 movi (datalabel barboth2 + 16) & 65535,r40
130 movi (barwithout + 24) & 65535,r30
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
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
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
159 ! Same as above, referencing symbol in other file *and* within that file.
161 .text
162 movi (datalabel baz + 8) & 65535,r30
164 movi (datalabel bazboth + 16) & 65535,r40
165 movi (bazboth + 12) & 65535,r40
167 movi (bazboth2 + 12) & 65535,r40
168 movi (datalabel bazboth2 + 16) & 65535,r40
170 movi (bazwithout + 24) & 65535,r30
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
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
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
199 ! Same as all of the above, but where the symbol is not an ISA32 one.
201 .data
202 .global dfoo
203 dfoo:
204 .long 0
205 .long (datalabel dfoo + 8)
207 .global dfooboth
208 dfooboth:
209 .long 0
210 .long (datalabel dfooboth + 16)
211 .long (dfooboth + 12)
213 .global dfooboth2
214 dfooboth2:
215 .long 0
216 .long (dfooboth2 + 12)
217 .long (datalabel dfooboth2 + 16)
219 .global dfoowithout
220 dfoowithout:
221 .long 0
222 .long (dfoowithout + 24)
224 .global dfoo_other
225 dfoo_other:
226 .long 0
227 .global dfoo_otherboth
228 dfoo_otherboth:
229 .long 0
230 .global dfoo_otherboth2
231 dfoo_otherboth2:
232 .long 0
233 .global dfoo_otherwithout
234 dfoo_otherwithout:
235 .long 0
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
245 .data
247 ! Same as above, mixing references from same and other section.
248 .global dfoo_mix
249 dfoo_mix:
250 .long 0
251 .long (datalabel dfoo_mix + 8)
252 .global dfoo_mix2
253 dfoo_mix2:
254 .long 0
255 .long (dfoo_mix2 + 8)
256 .global dfoo_mixboth
257 dfoo_mixboth:
258 .long 0
259 .long (datalabel dfoo_mixboth + 80)
260 .long (dfoo_mixboth + 80)
261 .global dfoo_mixboth2
262 dfoo_mixboth2:
263 .long 0
264 .long (dfoo_mixboth2 + 64)
265 .long (datalabel dfoo_mixboth2 + 64)
266 .global dfoo_mixwithout
267 dfoo_mixwithout:
268 .long 0
269 .long (dfoo_mixwithout + 42)
270 .global dfoo_mixwithout2
271 dfoo_mixwithout2:
272 .long 0
273 .long (dfoo_mixwithout2 + 24)
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
284 ! Same as above, referencing symbol in other file (reference only from
285 ! this to other file).
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
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
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
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
322 ! Same as above, referencing symbol in other file *and* within that file.
324 .text
325 movi (datalabel dbazboth + 16) & 65535,r40
326 movi (dbazboth + 12) & 65535,r40
328 movi (dbazboth2 + 12) & 65535,r40
329 movi (datalabel dbazboth2 + 16) & 65535,r40
331 movi (dbazwithout + 24) & 65535,r30
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
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
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