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