Remove i370 support
[deliverable/binutils-gdb.git] / gas / testsuite / gas / all / gas.exp
1 # Copyright (C) 2012-2018 Free Software Foundation, Inc.
2
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 3 of the License, or
6 # (at your option) any later version.
7 #
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
12 #
13 # You should have received a copy of the GNU General Public License
14 # along with this program; if not, write to the Free Software
15 # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
16
17 #
18 # These tests should be valid on all targets.
19 #
20
21 # I think currently all targets fail this one when listings are enabled.
22 gas_test "p2425.s" "" "" "pcrel values in assignment"
23
24 # p1480.s uses a ".space" directive which for most assemblers means
25 # "allocate some space". On the PA it means "switch into this space".
26 #
27 # Therefore this test (as it is currently written) is completely bogus
28 # for any PA target. Do not bother trying to run it and just claim
29 # it fails.
30 #
31 # The C54x uses ".space" to allocate bits, and requires absolute expressions;
32 # The ".space" directive is taken care of in the C54x-specific tests, so fail
33 # here
34 #
35 # The test also doesn't work on mep targets, since they use RELC, and it
36 # will avoid simplifying the expression since it conservatively assumes
37 # ugly expressions can be saved until link-time.
38 if { [istarget hppa*-*-*] || [istarget *c54x*-*-*] || [istarget mep*-*-*]} then {
39 setup_xfail *-*-*
40 fail "simplifiable double subtraction"
41 } else {
42 gas_test "p1480.s" "" "-a>" "simplifiable double subtraction"
43 }
44
45 # No floating point support in assembly code for CRIS and Z80.
46 if { ![istarget cris-*-*] && ![istarget crisv32-*-*]
47 && ![istarget z80-*-*] } then {
48 gas_test "float.s" "" "" "simple FP constants"
49 }
50
51 # This test is meaningless for the PA; the difference of two undefined
52 # symbols is something that is (and must be) supported on the PA.
53 # The same is true for ALPHA-VMS.
54 #
55 # The AVR, MICROBLAZE, MN10300, RL78 and RX ports all support link time
56 # relaxation, which in turn allows for link time resolution of the
57 # differences of two previously undefined symbols. Hence this test will
58 # not pass for these targets.
59 if { ![istarget alpha*-*-*vms*]
60 && ![istarget am3*-*-*]
61 && ![istarget avr-*-*]
62 && ![istarget ft32-*-*]
63 && ![istarget hppa*-*-*]
64 && ![istarget microblaze-*-*]
65 && ![istarget mn10300-*-*]
66 && ![istarget msp430*-*-*]
67 && ![istarget riscv*-*-*]
68 && ![istarget rl78-*-*]
69 && ![istarget rx-*-*] } then {
70 gas_test_error "diff1.s" "" "difference of two undefined symbols"
71 }
72
73 gas_test_error "equiv1.s" "" ".equiv for symbol already set to another one"
74 gas_test_error "equiv2.s" "" ".equiv for symbol already set to an expression"
75
76 gas_test_error "none.s" "-o $srcdir/$subdir/none.s" "Output file must be distinct from input"
77
78 # .equ works differently on some targets.
79 case $target_triplet in {
80 { hppa*-*-* } { }
81 { *c54x*-*-* } { }
82 default {
83 gas_test "equ-ok.s" "" "" ".equ for symbol already set"
84 gas_test_error "equ-bad.s" "" ".equ for symbol already set through .eqv"
85 }
86 }
87
88 gas_test "eqv-ok.s" "" "" ".eqv support"
89 gas_test_error "eqv-bad.s" "" ".eqv for symbol already set"
90
91 if { ![istarget "bfin-*-*"] } then {
92 gas_test "assign-ok.s" "" "" "== assignment support"
93 }
94 gas_test_error "assign-bad.s" "" "== assignment for symbol already set"
95
96 # .equ works differently on some targets.
97 # linkrelax-ing prevents most forward references from working.
98 case $target_triplet in {
99 { am3*-*-* } { }
100 { *c54x*-*-* } { }
101 { cr16*-*-* } { }
102 { crx*-*-* } { }
103 { h8300*-*-* } { }
104 { hppa*-*-* } { }
105 { mep-*-* } { }
106 { microblaze-*-* } { }
107 { mn10\[23\]00*-*-* } { }
108 default {
109 # Some targets don't manage to resolve BFD_RELOC_8 for constants.
110 setup_xfail "alpha*-*-*" "*c30*-*-*" "*c4x*-*-*" \
111 "d\[13\]0v*-*-*" \
112 "nds32*-*-*" "pdp11-*-*" "xtensa*-*-*"
113 run_dump_test forward
114 }
115 }
116
117 # aout relocs are often weird, so is mep. don't bother testing
118 # som doesn't use a .text section
119 # mmix doesn't like .L1:
120 # ti addresses aren't octets.
121 if { ![is_aout_format] } {
122 case $target_triplet in {
123 { hppa*64*-*-* } {
124 run_dump_test fwdexp
125 }
126 { alpha-*-*linux*ecoff } { }
127 { alpha-*-osf* } { }
128 { hppa*-*-hpux* } { }
129 { mep-*-* } { }
130 { mmix-*-* } { }
131 { nds32*-*-* } { }
132 { tic30*-*-* } { }
133 { tic4x*-*-* } { }
134 { tic54x*-*-* } { }
135 default {
136 run_dump_test fwdexp
137 }
138 }
139 }
140
141 # .set works differently on some targets.
142 # most of the tests won't work on targets that set linkrelax.
143 # 4 octet bytes confuse address matching on ti targets.
144 # pdp11 gets unexpected reloc types.
145 case $target_triplet in {
146 { alpha*-*-* } { }
147 { am3*-*-* } { }
148 { cr16*-*-* } { }
149 { crx*-*-* } { }
150 { h8300-*-* } { }
151 { mips*-*-* } { }
152 { mn10200-*-* } { }
153 { mn10300-*-* } { }
154 { msp430*-*-* } { }
155 { nds32*-*-* } { }
156 { pdp11-*-* } { }
157 { tic30*-*-* } { }
158 { tic4x*-*-* } { }
159 { tic54x*-*-* } { }
160 { xtensa*-*-* } { }
161 { z80-*-* } { }
162 default {
163 run_dump_test redef
164 setup_xfail "arm-epoc-pe*"
165 # These targets fail redef2 because they disallow redefined
166 # symbols on relocs.
167 setup_xfail "m68hc1*-*-*" "m6811-*-*" "m6812-*-*" "rl78-*-*"
168 setup_xfail "riscv*-*-*" "rx-*-*" "vax*-*-*" "xgate*-*-*" "z8k-*-*"
169 run_dump_test redef2
170 setup_xfail "m68hc1*-*-*" "m6811-*-*" "m6812-*-*" "rl78-*-*"
171 setup_xfail "riscv*-*-*" "rx-*-*" "vax*-*-*" "xgate*-*-*" "z8k-*-*"
172 # rs6000-aix disallows redefinition via .comm.
173 setup_xfail "*-*-aix*"
174 # SOM uses a different syntax for .comm
175 setup_xfail "hppa*-*-hpux*"
176 # These targets fail redef3 because section contents for the
177 # word referencing the .comm sym is not zero and/or its reloc
178 # has a non-zero addend. Relaxing the test would hide real
179 # failures.
180 setup_xfail "bfin-*-*" "i\[3-7\]86-*-*coff" \
181 "i\[3-7\]86-*-*pe" "i\[3-7\]86-*-go32*" \
182 "i\[3-7\]86-*-cygwin*" "i\[3-7\]86-*-mingw*" \
183 "x86_64-*-cygwin*" "x86_64-*-mingw*"
184 run_dump_test redef3
185 gas_test_error "redef4.s" "" ".set for symbol already used as label"
186 gas_test_error "redef5.s" "" ".set for symbol already defined through .comm"
187 }
188 }
189
190 proc do_comment {} {
191 set testname "comment.s: comments in listings"
192 set x1 0
193 set x2 0
194 set x3 0
195 set white {[ \t]*}
196 gas_start "comment.s" "-al"
197 while 1 {
198 # Apparently CRLF is received when using ptys for subprocesses; hence the
199 # \r\n for line 3.
200 expect {
201 -re "^ +1\[ \t\]+# This\[^\n\]*\n" { set x1 1 }
202 -re "^ +2\[ \t\]+# correctly\[^\n\]*\n" { set x2 1 }
203 -re "^ +3\[ \t\]+/. C comments too. ./\r?\r?\n" { set x3 1 }
204 -re "\[^\n\]*\n" { }
205 timeout { perror "timeout\n"; break }
206 eof { break }
207 }
208 }
209 gas_finish
210 if [all_ones $x1 $x2 $x3] then { pass $testname } else { fail $testname }
211 }
212
213 # m32c pads out sections, even empty ones.
214 case $target_triplet in {
215 { m32c-*-* } { }
216 default {
217 do_comment
218 }
219 }
220
221 # This test checks the output of the -ag switch. It must detect at least
222 # the name of the input file, output file, and options passed.
223 proc general_info_section {} {
224 set testname "general info section in listings"
225 set x1 0
226 set x2 0
227 set x3 0
228 set white {[ \t]*}
229 gas_start "comment.s" "-agn"
230 while 1 {
231 expect {
232 -re "^ \[^\n\]*\t: .*\-agn\[^\n\]*\n" { set x1 1 }
233 -re "^ \[^\n\]*\t: \[^\n\]*comment\.s\[^\n\]*\n" { set x2 1 }
234 -re "^ \[^\n\]*\t: a\.out\[^\n\]*\n" { set x3 1 }
235 -re "\[^\n\]*\n" { }
236 timeout { perror "timeout\n"; break }
237 eof { break }
238 }
239 }
240 gas_finish
241 if [all_ones $x1 $x2 $x3] then { pass $testname } else { fail $testname }
242 }
243
244 general_info_section
245
246 #
247 # Test x930509a -- correct assembly of differences involving forward
248 # references.
249 #
250
251 proc do_930509a {} {
252 set testname "difference between forward references"
253 set x 0
254 gas_start "x930509.s" "-al"
255 while 1 {
256 # We need to accommodate both byte orders here.
257 # If ".long" means an 8-byte value on some target someday, this test will have
258 # to be fixed.
259 expect {
260 -re "^ +1 .... 00 ?00 ?00 ?00" { fail $testname; set x 1 }
261 -re "^ +1 .... 04 ?00 ?00 ?00" { pass $testname; set x 1 }
262 -re "^ +1 .... 00 ?00 ?00 ?04" { pass $testname; set x 1 }
263 -re "\[^\n\]*\n" { }
264 timeout { perror "timeout\n"; break }
265 eof { break }
266 }
267 }
268 gas_finish
269 if !$x then { fail $testname }
270 }
271
272 # This test is meaningless for the PA and CR16/CRX: the difference of two
273 # symbols cannot be resolved by the assembler.
274 # C54x assembler (for compatibility) does not allow differences between
275 # forward references.
276 # C30 counts a four byte offset as a difference of one.
277 if { ![istarget *c30*-*-*]
278 && ![istarget *c4x*-*-*]
279 && ![istarget *c54x*-*-*]
280 && ![istarget cr16*-*-*]
281 && ![istarget crx*-*-*]
282 && ![istarget ft32-*-*]
283 && ![istarget h8300*-*-*]
284 && ![istarget hppa*-*-*] } then {
285 # The vax fails because VMS can apparently actually handle this
286 # case in relocs, so gas doesn't handle it itself.
287 # msp430, mn10[23]00 and riscv emit two relocs to handle the difference of two symbols.
288 setup_xfail "am3*-*-*" "mn10200-*-*" "mn10300*-*-*" "msp430*-*-*" "riscv*-*-*" "vax*-*-vms*"
289 do_930509a
290 }
291
292 # ".struct" and ".align" have different meanings on c54x
293 # These directives are done in the c54x-specific tests instead
294 case $target_triplet in {
295 { hppa*-*-* } { }
296 { *c4x*-*-* } { }
297 { *c54x*-*-* } { }
298 default {
299 run_dump_test struct
300 run_dump_test align
301 setup_xfail "ns32k-*-*"
302 run_dump_test align2
303 }
304 }
305
306 # '<' and '>' appear to have special meanings on the excluded targets
307 case $target_triplet in {
308 { frv-*-* } { }
309 { hppa*-*-* } { }
310 { m32r-*-* } { }
311 { mmix-*-* } { }
312 { *c4x*-*-* } { }
313 { *c54x*-*-* } { }
314 { bfin-*-* } { }
315 default {
316 run_dump_test altmacro
317 # The second test is valid only when '!' is not a comment
318 # character (it is allowed to be a line comment character).
319 if [string match "" [lindex [gas_run excl.s "-o /dev/null" ""] 0]] {
320 run_dump_test altmac2
321 # Similarly this test does not work when ! is a line separator.
322 run_dump_test eval
323 }
324 }
325 }
326
327 # This test is for any COFF target.
328 # We omit the ARM toolchains because they define locals to
329 # start with '.', which eliminates .eos, .text etc from the output.
330 # Omit c54x, since .tag and .def mean something different on that target
331 if { ([istarget *-*-coff*] && ![istarget arm*-*-coff] && ![istarget *c4x*-*-coff] && ![istarget *c54x*-*-coff]) \
332 ||([istarget *-*-pe*] && ![istarget arm*-*-pe*]) \
333 || [istarget i*86-*-aix*] \
334 || [istarget i*86-*-sco*] \
335 || [istarget i*86-*-isc*] \
336 || [istarget i*86-*-go32*] \
337 || [istarget i*86-*-cygwin*] \
338 || [istarget x86_64-*-mingw*] \
339 || [istarget i*86-*-*nt] \
340 || [istarget i*86-*-interix*] } {
341 run_dump_test cofftag
342 }
343
344 # Test omitting conditionals from listings.
345 proc test_cond {} {
346 global comp_output
347 global srcdir
348 global subdir
349
350 set testname "conditional listings"
351 gas_run cond.s "-alc" ">dump.out"
352 if ![string match "" $comp_output] {
353 send_log "$comp_output\n"
354 fail $testname
355 } else {
356 if { [regexp_diff dump.out $srcdir/$subdir/cond.l] } {
357 fail $testname
358 } else {
359 pass $testname
360 }
361 }
362 }
363
364 # This test is not suitable for the PA for various reasons
365 # not limited to the fact that it depends on specific section
366 # names appearing in the output file.
367 # Again, p2align doesn't work on c54x and related targets.
368 case $target_triplet in {
369 { alpha-*-linux*ecoff} { }
370 { alpha-*-osf*} { }
371 { hppa*-*-* } { }
372 { *c4x*-*-* } { }
373 { *c54x*-*-* } { }
374 { rl78-*-* } { }
375 { rx-*-* } { }
376 default {
377 test_cond
378 remote_download host "$srcdir/$subdir/incbin.dat"
379 run_dump_test incbin
380 }
381 }
382
383 if { ([istarget "i*86-*-*pe*"] && ![istarget "i*86-*-openbsd*"]) \
384 || [istarget "i*86-*-cygwin*"] \
385 || [istarget "i*86-*-mingw32*"] } {
386 gas_test "fastcall.s" "" "" "fastcall labels"
387 }
388
389 if { ![istarget "bfin-*-*"] && ![istarget "nds32*-*-*"] } then {
390 run_dump_test assign
391 }
392 run_dump_test sleb128
393 run_dump_test sleb128-2
394 run_dump_test sleb128-3
395 setup_xfail "nds32*-*-*"
396 run_dump_test sleb128-4
397 run_dump_test sleb128-5
398 # .byte is not 8 bits on either tic4x or tic54x
399 if { ![istarget "tic4x*-*-*"] && ![istarget "tic54x*-*-*"] } {
400 run_dump_test sleb128-7
401 run_dump_test sleb128-8
402 }
403 run_dump_test sleb128-9
404
405 # .byte is 32 bits on tic4x, and .p2align isn't supported on tic54x
406 # .space is different on hppa*-hpux.
407 # MeP put bytes into packets.
408 if { ![istarget "tic4x*-*-*"] && ![istarget "tic54x*-*-*"] && ![istarget "hppa*-*-hpux*"] && ![istarget "mep*-*-*"] } {
409 run_dump_test relax
410 }
411
412 # powerpc and s390 allow a string argument to .byte
413 if { ![istarget "powerpc*-*-*"] && ![istarget "rs6000*-*-*"] && ![istarget "s390*-*-*"] } {
414 run_dump_test byte
415 }
416
417 run_dump_test quad
418
419 # som doesn't use .data section.
420 case $target_triplet in {
421 { hppa*64*-*-* } {
422 run_dump_test octa
423 }
424 { hppa*-*-hpux* } { }
425 default {
426 run_dump_test octa
427 }
428 }
429
430 # .set works differently on some targets.
431 case $target_triplet in {
432 { alpha*-*-* } { }
433 { mips*-*-* } { }
434 { *c54x*-*-* } { }
435 { z80-*-* } { }
436 default {
437 setup_xfail "nds32*-*-*"
438 run_dump_test weakref1
439 run_dump_test weakref1g
440 run_dump_test weakref1l
441 run_dump_test weakref1u
442 run_dump_test weakref1w
443 }
444 }
445 gas_test_error "weakref2.s" "" "e: would close weakref loop: e => a => b => c => d => e"
446 gas_test_error "weakref3.s" "" "a: would close weakref loop: a => b => c => d => e => a"
447 gas_test_error "weakref4.s" "" "is already defined"
448
449 run_dump_test string
450 if [is_elf_format] {
451 run_dump_test none
452 }
453
454 run_dump_test quoted-sym-names
455
456 run_list_test pr20312
457
458 load_lib gas-dg.exp
459 dg-init
460 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/err-*.s $srcdir/$subdir/warn-*.s]] "" ""
461 dg-finish
462
463 # Set $nop_type appropriately to indicate the NOP instruction mnemonic.
464 case $target_triplet in {
465 { "mmix-*-*" } {
466 set nop_type 5
467 }
468 { "or1k*-*-*" } {
469 set nop_type 2
470 }
471 { "ia64-*-*" } {
472 set nop_type 1
473 }
474 default {
475 set nop_type 0
476 }
477 }
478 run_dump_test "org-1" [list [list as "--defsym nop_type=$nop_type"]]
479 run_dump_test "org-2"
480 run_dump_test "org-3"
481 run_dump_test "org-4"
482 run_dump_test "org-5"
483 run_dump_test "org-6"
484
485 run_dump_test "fill-1"
This page took 0.043603 seconds and 5 git commands to generate.