* read.c (potable): Add string8, string16, string32 and string64. Add bit size for...
[deliverable/binutils-gdb.git] / gas / testsuite / gas / all / gas.exp
CommitLineData
252b5132
RH
1#
2# These tests should be valid on all targets.
3#
4
5# I think currently all targets fail this one when listings are enabled.
6gas_test "p2425.s" "" "" "pcrel values in assignment"
7
8# p1480.s uses a ".space" directive which for most assemblers means
9# "allocate some space". On the PA it means "switch into this space".
10#
11# Therefore this test (as it is currently written) is completely bogus
12# for any PA target. Do not bother trying to run it and just claim
13# it fails.
39bec121
TW
14#
15# The C54x uses ".space" to allocate bits, and requires absolute expressions;
16# The ".space" directive is taken care of in the C54x-specific tests, so fail
17# here
18#
280d71bf
DB
19# The test also doesn't work on mep targets, since they use RELC, and it
20# will avoid simplifying the expression since it conservatively assumes
21# ugly expressions can be saved until link-time.
22if { [istarget hppa*-*-*] || [istarget *c54x*-*-*] || [istarget mep*-*-*]} then {
252b5132
RH
23 setup_xfail *-*-*
24 fail "simplifiable double subtraction"
25} else {
26 gas_test "p1480.s" "" "-a>" "simplifiable double subtraction"
27}
28
3c9b82ba
NC
29# No floating point support in assembly code for CRIS and Z80.
30if { ![istarget cris-*-*] && ![istarget crisv32-*-*]
31 && ![istarget z80-*-*] } then {
483f05e3
HPN
32 gas_test "float.s" "" "" "simple FP constants"
33}
252b5132
RH
34
35# This test is meaningless for the PA; the difference of two undefined
36# symbols is something that is (and must be) supported on the PA.
37if ![istarget hppa*-*-*] then {
38 gas_test_error "diff1.s" "" "difference of two undefined symbols"
39}
40
9497f5ac
NC
41gas_test_error "equiv1.s" "" ".equiv for symbol already set to another one"
42gas_test_error "equiv2.s" "" ".equiv for symbol already set to an expression"
43
44# .equ works differently on some targets.
45case $target_triplet in {
46 { hppa*-*-* } { }
47 { *c54x*-*-* } { }
48 default {
49 gas_test "equ-ok.s" "" "" ".equ for symbol already set"
50 gas_test_error "equ-bad.s" "" ".equ for symbol already set through .eqv"
51 }
52}
53
54gas_test "eqv-ok.s" "" "" ".eqv support"
55gas_test_error "eqv-bad.s" "" ".eqv for symbol already set"
56
57gas_test "assign-ok.s" "" "" "== assignment support"
58gas_test_error "assign-bad.s" "" "== assignment for symbol already set"
59
60# .equ works differently on some targets.
61# linkrelax-ing prevents most forward references from working.
62case $target_triplet in {
3ccac826 63 { cr16*-*-* } { }
9497f5ac
NC
64 { crx*-*-* } { }
65 { h8300*-*-* } { }
66 { hppa*-*-* } { }
67 { mn10\[23\]00*-*-* } { }
68 { *c54x*-*-* } { }
69 default {
70 # Some targets don't manage to resolve BFD_RELOC_8 for constants.
71 setup_xfail "alpha*-*-*" "avr-*-*" "*c30*-*-*" "*c4x*-*-*" \
72 "d\[13\]0v*-*-*" "i860-*-*" "mips*-*-*" "msp430-*-*" \
73 "pdp11-*-*" "sparc*-*-*" "xtensa-*-*"
74 run_dump_test forward
75 }
76}
77
78# .set works differently on some targets.
79case $target_triplet in {
80 { alpha*-*-* } { }
9497f5ac
NC
81 { mips*-*-* } { }
82 { *c54x*-*-* } { }
3c9b82ba 83 { z80-*-* } { }
9497f5ac
NC
84 default {
85 setup_xfail "*c30*-*-*" "*c4x*-*-*" "pdp11-*-*"
86 run_dump_test redef
7b5030c0
NC
87 # The next two tests can fail if the target does not convert fixups
88 # against ordinary symbols into relocations against section symbols.
89 # This is usually revealed by the error message:
90 # symbol `sym' required but not present
92757bc9
JB
91 setup_xfail "*c30*-*-*" "*c4x*-*-*" "*arm*-*-*aout*" "*arm*-*-*coff" \
92 "*arm*-*-pe" "crx*-*-*" "h8300*-*-*" "m68hc*-*-*" "maxq-*-*" \
3d3d428f 93 "mn10300-*-*" "pdp11-*-*" "vax*-*-*" "z8k-*-*" "cr16-*-*"
5ca0ee01 94 run_dump_test redef2
92757bc9 95 setup_xfail "*-*-aix*" "*-*-coff" "*-*-cygwin" "*-*-mingw*" "*-*-pe*" \
6745c726 96 "bfin-*-*" "*c4x*-*-*" "crx*-*-*" "h8300*-*-*" "hppa*-*-hpux*" \
7b5030c0 97 "m68hc*-*-*" "maxq-*-*" "mn10300-*-*" "or32-*-*" "pdp11-*-*" \
3d3d428f 98 "vax*-*-*" "z8k-*-*" "cr16-*-*"
92757bc9
JB
99 run_dump_test redef3
100 setup_xfail "*c4x*-*-*"
101 gas_test_error "redef4.s" "" ".set for symbol already used as label"
102 setup_xfail "*c4x*-*-*"
103 gas_test_error "redef5.s" "" ".set for symbol already defined through .comm"
9497f5ac
NC
104 }
105}
106
252b5132
RH
107proc do_comment {} {
108 set testname "comment.s: comments in listings"
109 set x1 0
110 set x2 0
111 set x3 0
112 set white {[ \t]*}
113 gas_start "comment.s" "-al"
114 while 1 {
115# Apparently CRLF is received when using ptys for subprocesses; hence the
116# \r\n for line 3.
117 expect {
118 -re "^ +1\[ \t\]+# This\[^\n\]*\n" { set x1 1 }
119 -re "^ +2\[ \t\]+# correctly\[^\n\]*\n" { set x2 1 }
7f6a71ff 120 -re "^ +3\[ \t\]+/. C comments too. ./\r?\r?\n" { set x3 1 }
252b5132
RH
121 -re "\[^\n\]*\n" { }
122 timeout { perror "timeout\n"; break }
123 eof { break }
124 }
125 }
126 gas_finish
127 if [all_ones $x1 $x2 $x3] then { pass $testname } else { fail $testname }
128}
129
130do_comment
131
132#
133# Test x930509a -- correct assembly of differences involving forward
134# references.
135#
136
137proc do_930509a {} {
138 set testname "difference between forward references"
139 set x 0
140 gas_start "x930509.s" "-al"
141 while 1 {
142# We need to accomodate both byte orders here.
143# If ".long" means an 8-byte value on some target someday, this test will have
144# to be fixed.
145 expect {
224de7a5
AM
146 -re "^ +1 .... 00 ?00 ?00 ?00" { fail $testname; set x 1 }
147 -re "^ +1 .... 04 ?00 ?00 ?00" { pass $testname; set x 1 }
148 -re "^ +1 .... 00 ?00 ?00 ?04" { pass $testname; set x 1 }
252b5132
RH
149 -re "\[^\n\]*\n" { }
150 timeout { perror "timeout\n"; break }
151 eof { break }
152 }
153 }
154 gas_finish
155 if !$x then { fail $testname }
156}
157
3ccac826
NC
158# This test is meaningless for the PA and CR16/CRX: the difference of two
159# symbols cannot be resolved by the assembler.
39bec121 160# C54x assembler (for compatibility) does not allow differences between
3ccac826 161# forward references.
8bda4946 162# C30 counts a four byte offset as a difference of one.
48c5eb8a 163if { ![istarget hppa*-*-*] &&
3ccac826 164 ![istarget cr16*-*-*] &&
670ec21d 165 ![istarget crx*-*-*] &&
48c5eb8a
SS
166 ![istarget *c30*-*-*] &&
167 ![istarget *c4x*-*-*] &&
168 ![istarget *c54x*-*-*] } then {
252b5132
RH
169 # the vax fails because VMS can apparently actually handle this
170 # case in relocs, so gas doesn't handle it itself.
8bda4946 171 setup_xfail "h8300*-*-elf*" "mn10200*-*-*" "mn10300*-*-*" "vax*-*-vms*"
252b5132
RH
172 do_930509a
173}
174
39bec121
TW
175# ".struct" and ".align" have different meanings on c54x
176# These directives are done in the c54x-specific tests instead
252b5132
RH
177case $target_triplet in {
178 { hppa*-*-* } { }
48c5eb8a 179 { *c4x*-*-* } { }
39bec121 180 { *c54x*-*-* } { }
252b5132
RH
181 default {
182 run_dump_test struct
183 run_dump_test align
76101304 184 run_dump_test align2
252b5132
RH
185 }
186}
187
5069eab2
NC
188# '<' and '>' appear to have special meanings on the excluded targets
189case $target_triplet in {
5069eab2
NC
190 { frv-*-* } { }
191 { hppa*-*-* } { }
192 { m32r-*-* } { }
193 { mmix-*-* } { }
194 { *c4x*-*-* } { }
195 { *c54x*-*-* } { }
8df55cb8 196 { bfin-*-* } { }
5069eab2
NC
197 default {
198 run_dump_test altmacro
199 # The second test is valid only when '!' is not a comment
200 # character (it is allowed to be a line comment character).
26a78d4a 201 if [string match "" [lindex [gas_run excl.s "-o /dev/null" ""] 0]] {
5069eab2 202 run_dump_test altmac2
9497f5ac
NC
203 # Similarly this test does not work when ! is a line seperator.
204 run_dump_test eval
5069eab2
NC
205 }
206 }
207}
caa32fe5 208
252b5132 209# This test is for any COFF target.
252b5132
RH
210# We omit the ARM toolchains because they define locals to
211# start with '.', which eliminates .eos, .text etc from the output.
39bec121 212# Omit c54x, since .tag and .def mean something different on that target
e627d9a0 213if { ([istarget *-*-coff*] && ![istarget *arm*-*-coff] && ![istarget thumb*-*-coff] && ![istarget xscale-*-coff] && ![istarget *c4x*-*-coff] && ![istarget *c54x*-*-coff]) \
252b5132 214 ||([istarget *-*-pe*] && ![istarget arm*-*-pe*] && ![istarget thumb*-*-pe*]) \
252b5132
RH
215 || [istarget i*86-*-aix*] \
216 || [istarget i*86-*-sco*] \
217 || [istarget i*86-*-isc*] \
218 || [istarget i*86-*-go32*] \
219 || [istarget i*86-*-cygwin*] \
42037fe5 220 || [istarget x86_64-*-mingw*] \
252b5132 221 || [istarget i*86-*-*nt] \
61feeec2 222 || [istarget i*86-*-interix*] \
252b5132
RH
223 || ([istarget i960-*-vxworks5.*] && ![istarget i960-*-vxworks5.0*]) } {
224 run_dump_test cofftag
225}
226
227# Test omitting conditionals from listings.
228proc test_cond {} {
229 global comp_output
230 global srcdir
231 global subdir
232
233 set testname "conditional listings"
224de7a5 234 gas_run cond.s "-alc" ">dump.out"
252b5132
RH
235 if ![string match "" $comp_output] {
236 send_log "$comp_output\n"
237 fail $testname
238 } else {
9497f5ac 239 if { [regexp_diff dump.out $srcdir/$subdir/cond.l] } {
252b5132
RH
240 fail $testname
241 } else {
242 pass $testname
243 }
244 }
245}
246
c8060cba
JL
247# This test is not suitable for the PA for various reasons
248# not limited to the fact that it depends on specific section
249# names appearing in the output file.
39bec121 250# again, p2align doesn't work on c54x target
aceebfd6
NC
251case $target_triplet in {
252 { hppa*-*-* } { }
48c5eb8a 253 { *c4x*-*-* } { }
aceebfd6
NC
254 { *c54x*-*-* } { }
255 default {
256 test_cond
7f6a71ff 257 remote_download host "$srcdir/$subdir/incbin.dat"
aceebfd6
NC
258 run_dump_test incbin
259 }
39bec121 260}
c9e38879 261
01ed09aa 262if { ([istarget "i*86-*-*pe*"] && ![istarget "i*86-*-openbsd*"]) \
b46c1691
NC
263 || [istarget "i*86-*-cygwin*"] \
264 || [istarget "i*86-*-mingw32*"] } {
265 gas_test "fastcall.s" "" "" "fastcall labels"
266}
a7eec876 267
6efba987 268run_dump_test assign
e5604d79 269run_dump_test sleb128
ddc07134 270
5e9ed83f
L
271# .byte is 32 bits on tic4x, and .p2align isn't supported on tic54x
272if { ![istarget "tic4x*-*-*"] && ![istarget "tic54x*-*-*"] } {
273 run_dump_test relax
274}
275
ddc07134
AM
276# .quad is 16 bytes on i960.
277if { ![istarget "i960-*-*"] } {
278 run_dump_test quad
279}
e5604d79 280
3c9b82ba
NC
281
282# .set works differently on some targets.
283case $target_triplet in {
92757bc9
JB
284 { alpha*-*-* } { }
285 { mips*-*-* } { }
286 { *c54x*-*-* } { }
3c9b82ba
NC
287 { z80-*-* } { }
288 default {
289 run_dump_test weakref1
290 run_dump_test weakref1g
291 run_dump_test weakref1l
292 run_dump_test weakref1u
293 run_dump_test weakref1w
294 }
295}
06e77878
AO
296gas_test_error "weakref2.s" "" "e: would close weakref loop: e => a => b => c => d => e"
297gas_test_error "weakref3.s" "" "a: would close weakref loop: a => b => c => d => e => a"
b54788f8 298gas_test_error "weakref4.s" "" "is already defined"
06e77878 299
38a57ae7
NC
300run_dump_test string
301
a7eec876
HPN
302load_lib gas-dg.exp
303dg-init
304dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/err-*.s $srcdir/$subdir/warn-*.s]] "" ""
305dg-finish
This page took 0.458633 seconds and 4 git commands to generate.