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