Fix comment attached to #endif
[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 {
63 { crx*-*-* } { }
64 { h8300*-*-* } { }
65 { hppa*-*-* } { }
66 { mn10\[23\]00*-*-* } { }
67 { *c54x*-*-* } { }
68 default {
69 # Some targets don't manage to resolve BFD_RELOC_8 for constants.
70 setup_xfail "alpha*-*-*" "avr-*-*" "*c30*-*-*" "*c4x*-*-*" \
71 "d\[13\]0v*-*-*" "i860-*-*" "mips*-*-*" "msp430-*-*" \
72 "pdp11-*-*" "sparc*-*-*" "xtensa-*-*"
73 run_dump_test forward
74 }
75}
76
77# .set works differently on some targets.
78case $target_triplet in {
79 { alpha*-*-* } { }
9497f5ac
NC
80 { mips*-*-* } { }
81 { *c54x*-*-* } { }
3c9b82ba 82 { z80-*-* } { }
9497f5ac
NC
83 default {
84 setup_xfail "*c30*-*-*" "*c4x*-*-*" "pdp11-*-*"
85 run_dump_test redef
92757bc9
JB
86 setup_xfail "*c30*-*-*" "*c4x*-*-*" "*arm*-*-*aout*" "*arm*-*-*coff" \
87 "*arm*-*-pe" "crx*-*-*" "h8300*-*-*" "m68hc*-*-*" "maxq-*-*" \
88 "pdp11-*-*" "vax*-*-*" "z8k-*-*"
5ca0ee01 89 run_dump_test redef2
92757bc9 90 setup_xfail "*-*-aix*" "*-*-coff" "*-*-cygwin" "*-*-mingw*" "*-*-pe*" \
6745c726
DA
91 "bfin-*-*" "*c4x*-*-*" "crx*-*-*" "h8300*-*-*" "hppa*-*-hpux*" \
92 "m68hc*-*-*" "maxq-*-*" "or32-*-*" "pdp11-*-*" "vax*-*-*" "z8k-*-*"
92757bc9
JB
93 run_dump_test redef3
94 setup_xfail "*c4x*-*-*"
95 gas_test_error "redef4.s" "" ".set for symbol already used as label"
96 setup_xfail "*c4x*-*-*"
97 gas_test_error "redef5.s" "" ".set for symbol already defined through .comm"
9497f5ac
NC
98 }
99}
100
252b5132
RH
101proc do_comment {} {
102 set testname "comment.s: comments in listings"
103 set x1 0
104 set x2 0
105 set x3 0
106 set white {[ \t]*}
107 gas_start "comment.s" "-al"
108 while 1 {
109# Apparently CRLF is received when using ptys for subprocesses; hence the
110# \r\n for line 3.
111 expect {
112 -re "^ +1\[ \t\]+# This\[^\n\]*\n" { set x1 1 }
113 -re "^ +2\[ \t\]+# correctly\[^\n\]*\n" { set x2 1 }
114 -re "^ +3\[ \t\]+/. C comments too. ./\r?\n" { set x3 1 }
115 -re "\[^\n\]*\n" { }
116 timeout { perror "timeout\n"; break }
117 eof { break }
118 }
119 }
120 gas_finish
121 if [all_ones $x1 $x2 $x3] then { pass $testname } else { fail $testname }
122}
123
124do_comment
125
126#
127# Test x930509a -- correct assembly of differences involving forward
128# references.
129#
130
131proc do_930509a {} {
132 set testname "difference between forward references"
133 set x 0
134 gas_start "x930509.s" "-al"
135 while 1 {
136# We need to accomodate both byte orders here.
137# If ".long" means an 8-byte value on some target someday, this test will have
138# to be fixed.
139 expect {
224de7a5
AM
140 -re "^ +1 .... 00 ?00 ?00 ?00" { fail $testname; set x 1 }
141 -re "^ +1 .... 04 ?00 ?00 ?00" { pass $testname; set x 1 }
142 -re "^ +1 .... 00 ?00 ?00 ?04" { pass $testname; set x 1 }
252b5132
RH
143 -re "\[^\n\]*\n" { }
144 timeout { perror "timeout\n"; break }
145 eof { break }
146 }
147 }
148 gas_finish
149 if !$x then { fail $testname }
150}
151
670ec21d 152# This test is meaningless for the PA and CRX; the difference of two symbols
252b5132 153# must not be resolved by the assembler.
39bec121
TW
154# C54x assembler (for compatibility) does not allow differences between
155# forward references
8bda4946 156# C30 counts a four byte offset as a difference of one.
48c5eb8a 157if { ![istarget hppa*-*-*] &&
670ec21d 158 ![istarget crx*-*-*] &&
48c5eb8a
SS
159 ![istarget *c30*-*-*] &&
160 ![istarget *c4x*-*-*] &&
161 ![istarget *c54x*-*-*] } then {
252b5132
RH
162 # the vax fails because VMS can apparently actually handle this
163 # case in relocs, so gas doesn't handle it itself.
8bda4946 164 setup_xfail "h8300*-*-elf*" "mn10200*-*-*" "mn10300*-*-*" "vax*-*-vms*"
252b5132
RH
165 do_930509a
166}
167
39bec121
TW
168# ".struct" and ".align" have different meanings on c54x
169# These directives are done in the c54x-specific tests instead
252b5132
RH
170case $target_triplet in {
171 { hppa*-*-* } { }
48c5eb8a 172 { *c4x*-*-* } { }
39bec121 173 { *c54x*-*-* } { }
252b5132
RH
174 default {
175 run_dump_test struct
176 run_dump_test align
76101304 177 run_dump_test align2
252b5132
RH
178 }
179}
180
5069eab2
NC
181# '<' and '>' appear to have special meanings on the excluded targets
182case $target_triplet in {
5069eab2
NC
183 { frv-*-* } { }
184 { hppa*-*-* } { }
185 { m32r-*-* } { }
186 { mmix-*-* } { }
187 { *c4x*-*-* } { }
188 { *c54x*-*-* } { }
8df55cb8 189 { bfin-*-* } { }
5069eab2
NC
190 default {
191 run_dump_test altmacro
192 # The second test is valid only when '!' is not a comment
193 # character (it is allowed to be a line comment character).
26a78d4a 194 if [string match "" [lindex [gas_run excl.s "-o /dev/null" ""] 0]] {
5069eab2 195 run_dump_test altmac2
9497f5ac
NC
196 # Similarly this test does not work when ! is a line seperator.
197 run_dump_test eval
5069eab2
NC
198 }
199 }
200}
caa32fe5 201
252b5132 202# This test is for any COFF target.
252b5132
RH
203# We omit the ARM toolchains because they define locals to
204# start with '.', which eliminates .eos, .text etc from the output.
39bec121 205# Omit c54x, since .tag and .def mean something different on that target
e627d9a0 206if { ([istarget *-*-coff*] && ![istarget *arm*-*-coff] && ![istarget thumb*-*-coff] && ![istarget xscale-*-coff] && ![istarget *c4x*-*-coff] && ![istarget *c54x*-*-coff]) \
252b5132 207 ||([istarget *-*-pe*] && ![istarget arm*-*-pe*] && ![istarget thumb*-*-pe*]) \
252b5132
RH
208 || [istarget i*86-*-aix*] \
209 || [istarget i*86-*-sco*] \
210 || [istarget i*86-*-isc*] \
211 || [istarget i*86-*-go32*] \
212 || [istarget i*86-*-cygwin*] \
42037fe5 213 || [istarget x86_64-*-mingw*] \
252b5132 214 || [istarget i*86-*-*nt] \
61feeec2 215 || [istarget i*86-*-interix*] \
252b5132
RH
216 || ([istarget i960-*-vxworks5.*] && ![istarget i960-*-vxworks5.0*]) } {
217 run_dump_test cofftag
218}
219
220# Test omitting conditionals from listings.
221proc test_cond {} {
222 global comp_output
223 global srcdir
224 global subdir
225
226 set testname "conditional listings"
224de7a5 227 gas_run cond.s "-alc" ">dump.out"
252b5132
RH
228 if ![string match "" $comp_output] {
229 send_log "$comp_output\n"
230 fail $testname
231 } else {
9497f5ac 232 if { [regexp_diff dump.out $srcdir/$subdir/cond.l] } {
252b5132
RH
233 fail $testname
234 } else {
235 pass $testname
236 }
237 }
238}
239
c8060cba
JL
240# This test is not suitable for the PA for various reasons
241# not limited to the fact that it depends on specific section
242# names appearing in the output file.
39bec121 243# again, p2align doesn't work on c54x target
aceebfd6
NC
244case $target_triplet in {
245 { hppa*-*-* } { }
48c5eb8a 246 { *c4x*-*-* } { }
aceebfd6
NC
247 { *c54x*-*-* } { }
248 default {
249 test_cond
250 run_dump_test incbin
251 }
39bec121 252}
c9e38879 253
01ed09aa 254if { ([istarget "i*86-*-*pe*"] && ![istarget "i*86-*-openbsd*"]) \
b46c1691
NC
255 || [istarget "i*86-*-cygwin*"] \
256 || [istarget "i*86-*-mingw32*"] } {
257 gas_test "fastcall.s" "" "" "fastcall labels"
258}
a7eec876 259
6efba987 260run_dump_test assign
e5604d79 261run_dump_test sleb128
ddc07134
AM
262
263# .quad is 16 bytes on i960.
264if { ![istarget "i960-*-*"] } {
265 run_dump_test quad
266}
e5604d79 267
3c9b82ba
NC
268
269# .set works differently on some targets.
270case $target_triplet in {
92757bc9
JB
271 { alpha*-*-* } { }
272 { mips*-*-* } { }
273 { *c54x*-*-* } { }
3c9b82ba
NC
274 { z80-*-* } { }
275 default {
276 run_dump_test weakref1
277 run_dump_test weakref1g
278 run_dump_test weakref1l
279 run_dump_test weakref1u
280 run_dump_test weakref1w
281 }
282}
06e77878
AO
283gas_test_error "weakref2.s" "" "e: would close weakref loop: e => a => b => c => d => e"
284gas_test_error "weakref3.s" "" "a: would close weakref loop: a => b => c => d => e => a"
b54788f8 285gas_test_error "weakref4.s" "" "is already defined"
06e77878 286
a7eec876
HPN
287load_lib gas-dg.exp
288dg-init
289dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/err-*.s $srcdir/$subdir/warn-*.s]] "" ""
290dg-finish
This page took 0.326147 seconds and 4 git commands to generate.