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