ns32k testsuite tidy
[deliverable/binutils-gdb.git] / gas / testsuite / gas / all / gas.exp
CommitLineData
82704155 1# Copyright (C) 2012-2019 Free Software Foundation, Inc.
5bf135a7
NC
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
252b5132
RH
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.
22gas_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.
39bec121
TW
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#
280d71bf
DB
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.
38if { [istarget hppa*-*-*] || [istarget *c54x*-*-*] || [istarget mep*-*-*]} then {
252b5132
RH
39 setup_xfail *-*-*
40 fail "simplifiable double subtraction"
41} else {
42 gas_test "p1480.s" "" "-a>" "simplifiable double subtraction"
43}
44
3c9b82ba
NC
45# No floating point support in assembly code for CRIS and Z80.
46if { ![istarget cris-*-*] && ![istarget crisv32-*-*]
47 && ![istarget z80-*-*] } then {
483f05e3
HPN
48 gas_test "float.s" "" "" "simple FP constants"
49}
252b5132
RH
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.
3ee6e4fb 53# The same is true for ALPHA-VMS.
569006e5 54#
3ee6e4fb
NC
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.
59if { ![istarget alpha*-*-*vms*]
60 && ![istarget am3*-*-*]
edc9e9a6 61 && ![istarget avr-*-*]
81b42bca 62 && ![istarget ft32-*-*]
3ee6e4fb
NC
63 && ![istarget hppa*-*-*]
64 && ![istarget microblaze-*-*]
c7927a3c 65 && ![istarget mn10300-*-*]
13761a11 66 && ![istarget msp430*-*-*]
8dfa5d5a 67 && ![istarget riscv*-*-*]
3ee6e4fb
NC
68 && ![istarget rl78-*-*]
69 && ![istarget rx-*-*] } then {
252b5132
RH
70 gas_test_error "diff1.s" "" "difference of two undefined symbols"
71}
72
9497f5ac
NC
73gas_test_error "equiv1.s" "" ".equiv for symbol already set to another one"
74gas_test_error "equiv2.s" "" ".equiv for symbol already set to an expression"
75
ca60b3af
SL
76# The inode comparison used to detect identical input and output files
77# doesn't work on non-Posix hosts.
78if { ![ishost "*-*-mingw*"] } then {
79 gas_test_error "none.s" "-o $srcdir/$subdir/none.s" "Output file must be distinct from input"
80}
67f846b5 81
9497f5ac
NC
82# .equ works differently on some targets.
83case $target_triplet in {
84 { hppa*-*-* } { }
85 { *c54x*-*-* } { }
86 default {
87 gas_test "equ-ok.s" "" "" ".equ for symbol already set"
88 gas_test_error "equ-bad.s" "" ".equ for symbol already set through .eqv"
89 }
90}
91
92gas_test "eqv-ok.s" "" "" ".eqv support"
93gas_test_error "eqv-bad.s" "" ".eqv for symbol already set"
e4c2619a 94run_dump_test eqv-dot
9497f5ac 95
3f904b16
AM
96if { ![istarget "bfin-*-*"] } then {
97 gas_test "assign-ok.s" "" "" "== assignment support"
98}
9497f5ac
NC
99gas_test_error "assign-bad.s" "" "== assignment for symbol already set"
100
1f38083f 101run_dump_test simple-forward
7553c869 102run_dump_test forward
9497f5ac 103
e8044f35 104# aout relocs are often weird, so is mep. don't bother testing
f9022510
AM
105# som doesn't use a .text section
106# mmix doesn't like .L1:
107# ti addresses aren't octets.
108if { ![is_aout_format] } {
109 case $target_triplet in {
01c51e44
DA
110 { hppa*64*-*-* } {
111 run_dump_test fwdexp
112 }
3ee6e4fb
NC
113 { alpha-*-*linux*ecoff } { }
114 { alpha-*-osf* } { }
01c51e44 115 { hppa*-*-hpux* } { }
f9022510 116 { mep-*-* } { }
f9022510 117 { mmix-*-* } { }
35c08157 118 { nds32*-*-* } { }
f9022510
AM
119 { tic30*-*-* } { }
120 { tic4x*-*-* } { }
121 { tic54x*-*-* } { }
122 default {
123 run_dump_test fwdexp
124 }
125 }
126}
127
9497f5ac 128# .set works differently on some targets.
f42fb574
AM
129# most of the tests won't work on targets that set linkrelax.
130# 4 octet bytes confuse address matching on ti targets.
131# pdp11 gets unexpected reloc types.
9497f5ac
NC
132case $target_triplet in {
133 { alpha*-*-* } { }
75800d2c 134 { am3*-*-* } { }
f42fb574
AM
135 { cr16*-*-* } { }
136 { crx*-*-* } { }
137 { h8300-*-* } { }
9497f5ac 138 { mips*-*-* } { }
f42fb574
AM
139 { mn10200-*-* } { }
140 { mn10300-*-* } { }
13761a11 141 { msp430*-*-* } { }
35c08157 142 { nds32*-*-* } { }
f42fb574
AM
143 { pdp11-*-* } { }
144 { tic30*-*-* } { }
145 { tic4x*-*-* } { }
146 { tic54x*-*-* } { }
147 { xtensa*-*-* } { }
3c9b82ba 148 { z80-*-* } { }
9497f5ac 149 default {
9497f5ac 150 run_dump_test redef
8b0aac0f
AM
151 # These targets fail redef2 because they disallow redefined
152 # symbols on relocs.
3ee6e4fb 153 setup_xfail "m68hc1*-*-*" "m6811-*-*" "m6812-*-*" "rl78-*-*"
e23eba97 154 setup_xfail "riscv*-*-*" "rx-*-*" "vax*-*-*" "xgate*-*-*" "z8k-*-*"
5ca0ee01 155 run_dump_test redef2
3ee6e4fb 156 setup_xfail "m68hc1*-*-*" "m6811-*-*" "m6812-*-*" "rl78-*-*"
e23eba97 157 setup_xfail "riscv*-*-*" "rx-*-*" "vax*-*-*" "xgate*-*-*" "z8k-*-*"
8b0aac0f
AM
158 # rs6000-aix disallows redefinition via .comm.
159 setup_xfail "*-*-aix*"
8b0aac0f
AM
160 # These targets fail redef3 because section contents for the
161 # word referencing the .comm sym is not zero and/or its reloc
162 # has a non-zero addend. Relaxing the test would hide real
73589c9d 163 # failures.
8b0aac0f
AM
164 setup_xfail "bfin-*-*" "i\[3-7\]86-*-*coff" \
165 "i\[3-7\]86-*-*pe" "i\[3-7\]86-*-go32*" \
3ee6e4fb
NC
166 "i\[3-7\]86-*-cygwin*" "i\[3-7\]86-*-mingw*" \
167 "x86_64-*-cygwin*" "x86_64-*-mingw*"
92757bc9 168 run_dump_test redef3
92757bc9 169 gas_test_error "redef4.s" "" ".set for symbol already used as label"
92757bc9 170 gas_test_error "redef5.s" "" ".set for symbol already defined through .comm"
9497f5ac
NC
171 }
172}
173
252b5132
RH
174proc do_comment {} {
175 set testname "comment.s: comments in listings"
176 set x1 0
177 set x2 0
178 set x3 0
179 set white {[ \t]*}
180 gas_start "comment.s" "-al"
181 while 1 {
182# Apparently CRLF is received when using ptys for subprocesses; hence the
183# \r\n for line 3.
184 expect {
185 -re "^ +1\[ \t\]+# This\[^\n\]*\n" { set x1 1 }
186 -re "^ +2\[ \t\]+# correctly\[^\n\]*\n" { set x2 1 }
7f6a71ff 187 -re "^ +3\[ \t\]+/. C comments too. ./\r?\r?\n" { set x3 1 }
252b5132
RH
188 -re "\[^\n\]*\n" { }
189 timeout { perror "timeout\n"; break }
190 eof { break }
191 }
192 }
193 gas_finish
194 if [all_ones $x1 $x2 $x3] then { pass $testname } else { fail $testname }
195}
196
bad6899a
AM
197# m32c pads out sections, even empty ones.
198case $target_triplet in {
199 { m32c-*-* } { }
200 default {
201 do_comment
202 }
203}
252b5132 204
83f10cb2
NC
205# This test checks the output of the -ag switch. It must detect at least
206# the name of the input file, output file, and options passed.
207proc general_info_section {} {
208 set testname "general info section in listings"
209 set x1 0
210 set x2 0
211 set x3 0
212 set white {[ \t]*}
213 gas_start "comment.s" "-agn"
214 while 1 {
215 expect {
c7927a3c 216 -re "^ \[^\n\]*\t: .*\-agn\[^\n\]*\n" { set x1 1 }
83f10cb2
NC
217 -re "^ \[^\n\]*\t: \[^\n\]*comment\.s\[^\n\]*\n" { set x2 1 }
218 -re "^ \[^\n\]*\t: a\.out\[^\n\]*\n" { set x3 1 }
219 -re "\[^\n\]*\n" { }
220 timeout { perror "timeout\n"; break }
221 eof { break }
222 }
223 }
224 gas_finish
225 if [all_ones $x1 $x2 $x3] then { pass $testname } else { fail $testname }
226}
227
228general_info_section
229
252b5132
RH
230#
231# Test x930509a -- correct assembly of differences involving forward
232# references.
233#
234
235proc do_930509a {} {
236 set testname "difference between forward references"
237 set x 0
238 gas_start "x930509.s" "-al"
239 while 1 {
c29ae970 240# We need to accommodate both byte orders here.
252b5132
RH
241# If ".long" means an 8-byte value on some target someday, this test will have
242# to be fixed.
243 expect {
224de7a5
AM
244 -re "^ +1 .... 00 ?00 ?00 ?00" { fail $testname; set x 1 }
245 -re "^ +1 .... 04 ?00 ?00 ?00" { pass $testname; set x 1 }
246 -re "^ +1 .... 00 ?00 ?00 ?04" { pass $testname; set x 1 }
252b5132
RH
247 -re "\[^\n\]*\n" { }
248 timeout { perror "timeout\n"; break }
249 eof { break }
250 }
251 }
252 gas_finish
253 if !$x then { fail $testname }
254}
255
3ccac826
NC
256# This test is meaningless for the PA and CR16/CRX: the difference of two
257# symbols cannot be resolved by the assembler.
39bec121 258# C54x assembler (for compatibility) does not allow differences between
3ccac826 259# forward references.
8bda4946 260# C30 counts a four byte offset as a difference of one.
3ee6e4fb
NC
261if { ![istarget *c30*-*-*]
262 && ![istarget *c4x*-*-*]
263 && ![istarget *c54x*-*-*]
264 && ![istarget cr16*-*-*]
265 && ![istarget crx*-*-*]
81b42bca 266 && ![istarget ft32-*-*]
3ee6e4fb
NC
267 && ![istarget h8300*-*-*]
268 && ![istarget hppa*-*-*] } then {
269 # The vax fails because VMS can apparently actually handle this
252b5132 270 # case in relocs, so gas doesn't handle it itself.
e23eba97 271 # msp430, mn10[23]00 and riscv emit two relocs to handle the difference of two symbols.
75800d2c 272 setup_xfail "am3*-*-*" "mn10200-*-*" "mn10300*-*-*" "msp430*-*-*" "riscv*-*-*" "vax*-*-vms*"
252b5132
RH
273 do_930509a
274}
275
39bec121
TW
276# ".struct" and ".align" have different meanings on c54x
277# These directives are done in the c54x-specific tests instead
252b5132
RH
278case $target_triplet in {
279 { hppa*-*-* } { }
48c5eb8a 280 { *c4x*-*-* } { }
39bec121 281 { *c54x*-*-* } { }
252b5132
RH
282 default {
283 run_dump_test struct
284 run_dump_test align
76101304 285 run_dump_test align2
252b5132
RH
286 }
287}
288
5069eab2
NC
289# '<' and '>' appear to have special meanings on the excluded targets
290case $target_triplet in {
5069eab2
NC
291 { frv-*-* } { }
292 { hppa*-*-* } { }
293 { m32r-*-* } { }
294 { mmix-*-* } { }
295 { *c4x*-*-* } { }
296 { *c54x*-*-* } { }
8df55cb8 297 { bfin-*-* } { }
5069eab2
NC
298 default {
299 run_dump_test altmacro
300 # The second test is valid only when '!' is not a comment
301 # character (it is allowed to be a line comment character).
26a78d4a 302 if [string match "" [lindex [gas_run excl.s "-o /dev/null" ""] 0]] {
5069eab2 303 run_dump_test altmac2
c29ae970 304 # Similarly this test does not work when ! is a line separator.
9497f5ac 305 run_dump_test eval
5069eab2
NC
306 }
307 }
308}
caa32fe5 309
252b5132 310# This test is for any COFF target.
252b5132
RH
311# We omit the ARM toolchains because they define locals to
312# start with '.', which eliminates .eos, .text etc from the output.
39bec121 313# Omit c54x, since .tag and .def mean something different on that target
8c5fc800
JM
314if { ([istarget *-*-coff*] && ![istarget arm*-*-coff] && ![istarget *c4x*-*-coff] && ![istarget *c54x*-*-coff]) \
315 ||([istarget *-*-pe*] && ![istarget arm*-*-pe*]) \
252b5132
RH
316 || [istarget i*86-*-aix*] \
317 || [istarget i*86-*-sco*] \
318 || [istarget i*86-*-isc*] \
319 || [istarget i*86-*-go32*] \
320 || [istarget i*86-*-cygwin*] \
42037fe5 321 || [istarget x86_64-*-mingw*] \
252b5132 322 || [istarget i*86-*-*nt] \
a8eb42a8 323 || [istarget i*86-*-interix*] } {
252b5132
RH
324 run_dump_test cofftag
325}
326
327# Test omitting conditionals from listings.
328proc test_cond {} {
329 global comp_output
330 global srcdir
331 global subdir
332
333 set testname "conditional listings"
224de7a5 334 gas_run cond.s "-alc" ">dump.out"
252b5132
RH
335 if ![string match "" $comp_output] {
336 send_log "$comp_output\n"
337 fail $testname
338 } else {
eb22018c 339 if { [regexp_diff dump.out $srcdir/$subdir/cond.l] } {
252b5132
RH
340 fail $testname
341 } else {
342 pass $testname
343 }
344 }
345}
346
c8060cba
JL
347# This test is not suitable for the PA for various reasons
348# not limited to the fact that it depends on specific section
349# names appearing in the output file.
3ee6e4fb 350# Again, p2align doesn't work on c54x and related targets.
aceebfd6 351case $target_triplet in {
3ee6e4fb
NC
352 { alpha-*-linux*ecoff} { }
353 { alpha-*-osf*} { }
aceebfd6 354 { hppa*-*-* } { }
48c5eb8a 355 { *c4x*-*-* } { }
aceebfd6 356 { *c54x*-*-* } { }
3ee6e4fb 357 { rl78-*-* } { }
c7927a3c 358 { rx-*-* } { }
aceebfd6
NC
359 default {
360 test_cond
7f6a71ff 361 remote_download host "$srcdir/$subdir/incbin.dat"
aceebfd6
NC
362 run_dump_test incbin
363 }
39bec121 364}
c9e38879 365
01ed09aa 366if { ([istarget "i*86-*-*pe*"] && ![istarget "i*86-*-openbsd*"]) \
b46c1691
NC
367 || [istarget "i*86-*-cygwin*"] \
368 || [istarget "i*86-*-mingw32*"] } {
369 gas_test "fastcall.s" "" "" "fastcall labels"
370}
a7eec876 371
35c08157 372if { ![istarget "bfin-*-*"] && ![istarget "nds32*-*-*"] } then {
3f904b16
AM
373 run_dump_test assign
374}
e5604d79 375run_dump_test sleb128
956a6ba3
JB
376run_dump_test sleb128-2
377run_dump_test sleb128-3
378run_dump_test sleb128-4
379run_dump_test sleb128-5
4455e9ad
JB
380# .byte is not 8 bits on either tic4x or tic54x
381if { ![istarget "tic4x*-*-*"] && ![istarget "tic54x*-*-*"] } {
382 run_dump_test sleb128-7
1a94eb29 383 run_dump_test sleb128-8
4455e9ad 384}
ba8826a8 385run_dump_test sleb128-9
ddc07134 386
5e9ed83f 387# .byte is 32 bits on tic4x, and .p2align isn't supported on tic54x
17b939cd 388# .space is different on hppa*-hpux.
ec0c103c
NC
389# MeP put bytes into packets.
390if { ![istarget "tic4x*-*-*"] && ![istarget "tic54x*-*-*"] && ![istarget "hppa*-*-hpux*"] && ![istarget "mep*-*-*"] } {
5e9ed83f
L
391 run_dump_test relax
392}
393
af47cd43
AK
394# powerpc and s390 allow a string argument to .byte
395if { ![istarget "powerpc*-*-*"] && ![istarget "rs6000*-*-*"] && ![istarget "s390*-*-*"] } {
9e59393e
AM
396 run_dump_test byte
397}
847d4311 398
a8eb42a8 399run_dump_test quad
0b1352e0 400run_dump_test octa
3c9b82ba
NC
401
402# .set works differently on some targets.
403case $target_triplet in {
92757bc9
JB
404 { alpha*-*-* } { }
405 { mips*-*-* } { }
406 { *c54x*-*-* } { }
3c9b82ba
NC
407 { z80-*-* } { }
408 default {
409 run_dump_test weakref1
410 run_dump_test weakref1g
411 run_dump_test weakref1l
412 run_dump_test weakref1u
413 run_dump_test weakref1w
414 }
415}
06e77878
AO
416gas_test_error "weakref2.s" "" "e: would close weakref loop: e => a => b => c => d => e"
417gas_test_error "weakref3.s" "" "a: would close weakref loop: a => b => c => d => e => a"
b54788f8 418gas_test_error "weakref4.s" "" "is already defined"
06e77878 419
38a57ae7 420run_dump_test string
740bdc67
AM
421if [is_elf_format] {
422 run_dump_test none
423}
38a57ae7 424
d02603dc
NC
425run_dump_test quoted-sym-names
426
93a24ba7
MR
427run_list_test pr20312
428
a7eec876
HPN
429load_lib gas-dg.exp
430dg-init
431dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/err-*.s $srcdir/$subdir/warn-*.s]] "" ""
432dg-finish
9875b365
MR
433
434# Set $nop_type appropriately to indicate the NOP instruction mnemonic.
435case $target_triplet in {
436 { "mmix-*-*" } {
437 set nop_type 5
438 }
9875b365
MR
439 { "or1k*-*-*" } {
440 set nop_type 2
441 }
442 { "ia64-*-*" } {
443 set nop_type 1
444 }
445 default {
446 set nop_type 0
447 }
448}
449run_dump_test "org-1" [list [list as "--defsym nop_type=$nop_type"]]
450run_dump_test "org-2"
451run_dump_test "org-3"
452run_dump_test "org-4"
453run_dump_test "org-5"
454run_dump_test "org-6"
4f2358bc 455
fa57faa0 456run_dump_test "fill-1"
0acc7632
AM
457
458gas_test "pr23938.s" "" "" ".xstabs"
This page took 0.9006 seconds and 4 git commands to generate.