* gas/all/gas.exp (do_comment): Don't run on m32c.
[deliverable/binutils-gdb.git] / gas / testsuite / gas / all / gas.exp
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.
6 gas_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.
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 #
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.
22 if { [istarget hppa*-*-*] || [istarget *c54x*-*-*] || [istarget mep*-*-*]} then {
23 setup_xfail *-*-*
24 fail "simplifiable double subtraction"
25 } else {
26 gas_test "p1480.s" "" "-a>" "simplifiable double subtraction"
27 }
28
29 # No floating point support in assembly code for CRIS and Z80.
30 if { ![istarget cris-*-*] && ![istarget crisv32-*-*]
31 && ![istarget z80-*-*] } then {
32 gas_test "float.s" "" "" "simple FP constants"
33 }
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.
37 #
38 # The MN10300 port supports link time relaxation which in turn allows
39 # for link time resolution of the differneces of two symbols which are
40 # undefined at assembly time. Hence this test will not pass for the
41 # MN10300.
42 if { ![istarget hppa*-*-*] && ![istarget mn10300-*-*] && ![istarget am3*-*-*] } then {
43 gas_test_error "diff1.s" "" "difference of two undefined symbols"
44 }
45
46 gas_test_error "equiv1.s" "" ".equiv for symbol already set to another one"
47 gas_test_error "equiv2.s" "" ".equiv for symbol already set to an expression"
48
49 # .equ works differently on some targets.
50 case $target_triplet in {
51 { hppa*-*-* } { }
52 { *c54x*-*-* } { }
53 default {
54 gas_test "equ-ok.s" "" "" ".equ for symbol already set"
55 gas_test_error "equ-bad.s" "" ".equ for symbol already set through .eqv"
56 }
57 }
58
59 gas_test "eqv-ok.s" "" "" ".eqv support"
60 gas_test_error "eqv-bad.s" "" ".eqv for symbol already set"
61
62 if { ![istarget "bfin-*-*"] } then {
63 gas_test "assign-ok.s" "" "" "== assignment support"
64 }
65 gas_test_error "assign-bad.s" "" "== assignment for symbol already set"
66
67 # .equ works differently on some targets.
68 # linkrelax-ing prevents most forward references from working.
69 case $target_triplet in {
70 { *c54x*-*-* } { }
71 { cr16*-*-* } { }
72 { crx*-*-* } { }
73 { h8300*-*-* } { }
74 { hppa*-*-* } { }
75 { mep-*-* } { }
76 { mn10\[23\]00*-*-* } { }
77 default {
78 # Some targets don't manage to resolve BFD_RELOC_8 for constants.
79 setup_xfail "alpha*-*-*" "avr-*-*" "*c30*-*-*" "*c4x*-*-*" \
80 "d\[13\]0v*-*-*" "i860-*-*" "mips*-*-*" "msp430-*-*" \
81 "pdp11-*-*" "sparc*-*-*" "xtensa*-*-*"
82 run_dump_test forward
83 }
84 }
85
86 # .set works differently on some targets.
87 # most of the tests won't work on targets that set linkrelax.
88 # 4 octet bytes confuse address matching on ti targets.
89 # pdp11 gets unexpected reloc types.
90 case $target_triplet in {
91 { alpha*-*-* } { }
92 { cr16*-*-* } { }
93 { crx*-*-* } { }
94 { h8300-*-* } { }
95 { mips*-*-* } { }
96 { mn10200-*-* } { }
97 { mn10300-*-* } { }
98 { pdp11-*-* } { }
99 { tic30*-*-* } { }
100 { tic4x*-*-* } { }
101 { tic54x*-*-* } { }
102 { xtensa*-*-* } { }
103 { z80-*-* } { }
104 default {
105 run_dump_test redef
106 # The next two tests can fail if the target does not convert fixups
107 # against ordinary symbols into relocations against section symbols.
108 # This is usually revealed by the error message:
109 # symbol `sym' required but not present
110 setup_xfail "*arm*-*-*aout*" "*arm*-*-*coff" \
111 "*arm*-*-pe" "m68hc*-*-*" "maxq-*-*" \
112 "vax*-*-*" "z8k-*-*"
113 run_dump_test redef2
114 setup_xfail "*-*-aix*" "*-*-coff" "*-*-cygwin" "*-*-mingw*" "*-*-pe*" \
115 "bfin-*-*" "hppa*-*-hpux*" \
116 "m68hc*-*-*" "maxq-*-*" "or32-*-*" \
117 "vax*-*-*" "z8k-*-*"
118 run_dump_test redef3
119 gas_test_error "redef4.s" "" ".set for symbol already used as label"
120 gas_test_error "redef5.s" "" ".set for symbol already defined through .comm"
121 }
122 }
123
124 proc do_comment {} {
125 set testname "comment.s: comments in listings"
126 set x1 0
127 set x2 0
128 set x3 0
129 set white {[ \t]*}
130 gas_start "comment.s" "-al"
131 while 1 {
132 # Apparently CRLF is received when using ptys for subprocesses; hence the
133 # \r\n for line 3.
134 expect {
135 -re "^ +1\[ \t\]+# This\[^\n\]*\n" { set x1 1 }
136 -re "^ +2\[ \t\]+# correctly\[^\n\]*\n" { set x2 1 }
137 -re "^ +3\[ \t\]+/. C comments too. ./\r?\r?\n" { set x3 1 }
138 -re "\[^\n\]*\n" { }
139 timeout { perror "timeout\n"; break }
140 eof { break }
141 }
142 }
143 gas_finish
144 if [all_ones $x1 $x2 $x3] then { pass $testname } else { fail $testname }
145 }
146
147 # m32c pads out sections, even empty ones.
148 case $target_triplet in {
149 { m32c-*-* } { }
150 default {
151 do_comment
152 }
153 }
154
155 # This test checks the output of the -ag switch. It must detect at least
156 # the name of the input file, output file, and options passed.
157 proc general_info_section {} {
158 set testname "general info section in listings"
159 set x1 0
160 set x2 0
161 set x3 0
162 set white {[ \t]*}
163 gas_start "comment.s" "-agn"
164 while 1 {
165 expect {
166 -re "^ \[^\n\]*\t: \-agn\[^\n\]*\n" { set x1 1 }
167 -re "^ \[^\n\]*\t: \[^\n\]*comment\.s\[^\n\]*\n" { set x2 1 }
168 -re "^ \[^\n\]*\t: a\.out\[^\n\]*\n" { set x3 1 }
169 -re "\[^\n\]*\n" { }
170 timeout { perror "timeout\n"; break }
171 eof { break }
172 }
173 }
174 gas_finish
175 if [all_ones $x1 $x2 $x3] then { pass $testname } else { fail $testname }
176 }
177
178 general_info_section
179
180 #
181 # Test x930509a -- correct assembly of differences involving forward
182 # references.
183 #
184
185 proc do_930509a {} {
186 set testname "difference between forward references"
187 set x 0
188 gas_start "x930509.s" "-al"
189 while 1 {
190 # We need to accomodate both byte orders here.
191 # If ".long" means an 8-byte value on some target someday, this test will have
192 # to be fixed.
193 expect {
194 -re "^ +1 .... 00 ?00 ?00 ?00" { fail $testname; set x 1 }
195 -re "^ +1 .... 04 ?00 ?00 ?00" { pass $testname; set x 1 }
196 -re "^ +1 .... 00 ?00 ?00 ?04" { pass $testname; set x 1 }
197 -re "\[^\n\]*\n" { }
198 timeout { perror "timeout\n"; break }
199 eof { break }
200 }
201 }
202 gas_finish
203 if !$x then { fail $testname }
204 }
205
206 # This test is meaningless for the PA and CR16/CRX: the difference of two
207 # symbols cannot be resolved by the assembler.
208 # C54x assembler (for compatibility) does not allow differences between
209 # forward references.
210 # C30 counts a four byte offset as a difference of one.
211 if { ![istarget hppa*-*-*] &&
212 ![istarget cr16*-*-*] &&
213 ![istarget crx*-*-*] &&
214 ![istarget *c30*-*-*] &&
215 ![istarget *c4x*-*-*] &&
216 ![istarget *c54x*-*-*] } then {
217 # the vax fails because VMS can apparently actually handle this
218 # case in relocs, so gas doesn't handle it itself.
219 setup_xfail "h8300*-*-elf*" "mn10200*-*-*" "mn10300*-*-*" "vax*-*-vms*"
220 do_930509a
221 }
222
223 # ".struct" and ".align" have different meanings on c54x
224 # These directives are done in the c54x-specific tests instead
225 case $target_triplet in {
226 { hppa*-*-* } { }
227 { *c4x*-*-* } { }
228 { *c54x*-*-* } { }
229 default {
230 run_dump_test struct
231 run_dump_test align
232 run_dump_test align2
233 }
234 }
235
236 # '<' and '>' appear to have special meanings on the excluded targets
237 case $target_triplet in {
238 { frv-*-* } { }
239 { hppa*-*-* } { }
240 { m32r-*-* } { }
241 { mmix-*-* } { }
242 { *c4x*-*-* } { }
243 { *c54x*-*-* } { }
244 { bfin-*-* } { }
245 default {
246 run_dump_test altmacro
247 # The second test is valid only when '!' is not a comment
248 # character (it is allowed to be a line comment character).
249 if [string match "" [lindex [gas_run excl.s "-o /dev/null" ""] 0]] {
250 run_dump_test altmac2
251 # Similarly this test does not work when ! is a line seperator.
252 run_dump_test eval
253 }
254 }
255 }
256
257 # This test is for any COFF target.
258 # We omit the ARM toolchains because they define locals to
259 # start with '.', which eliminates .eos, .text etc from the output.
260 # Omit c54x, since .tag and .def mean something different on that target
261 if { ([istarget *-*-coff*] && ![istarget *arm*-*-coff] && ![istarget thumb*-*-coff] && ![istarget xscale-*-coff] && ![istarget *c4x*-*-coff] && ![istarget *c54x*-*-coff]) \
262 ||([istarget *-*-pe*] && ![istarget arm*-*-pe*] && ![istarget thumb*-*-pe*]) \
263 || [istarget i*86-*-aix*] \
264 || [istarget i*86-*-sco*] \
265 || [istarget i*86-*-isc*] \
266 || [istarget i*86-*-go32*] \
267 || [istarget i*86-*-cygwin*] \
268 || [istarget x86_64-*-mingw*] \
269 || [istarget i*86-*-*nt] \
270 || [istarget i*86-*-interix*] \
271 || ([istarget i960-*-vxworks5.*] && ![istarget i960-*-vxworks5.0*]) } {
272 run_dump_test cofftag
273 }
274
275 # Test omitting conditionals from listings.
276 proc test_cond {} {
277 global comp_output
278 global srcdir
279 global subdir
280
281 set testname "conditional listings"
282 gas_run cond.s "-alc" ">dump.out"
283 if ![string match "" $comp_output] {
284 send_log "$comp_output\n"
285 fail $testname
286 } else {
287 if { [regexp_diff dump.out $srcdir/$subdir/cond.l] } {
288 fail $testname
289 } else {
290 pass $testname
291 }
292 }
293 }
294
295 # This test is not suitable for the PA for various reasons
296 # not limited to the fact that it depends on specific section
297 # names appearing in the output file.
298 # again, p2align doesn't work on c54x target
299 case $target_triplet in {
300 { hppa*-*-* } { }
301 { *c4x*-*-* } { }
302 { *c54x*-*-* } { }
303 default {
304 test_cond
305 remote_download host "$srcdir/$subdir/incbin.dat"
306 run_dump_test incbin
307 }
308 }
309
310 if { ([istarget "i*86-*-*pe*"] && ![istarget "i*86-*-openbsd*"]) \
311 || [istarget "i*86-*-cygwin*"] \
312 || [istarget "i*86-*-mingw32*"] } {
313 gas_test "fastcall.s" "" "" "fastcall labels"
314 }
315
316 if { ![istarget "bfin-*-*"] } then {
317 run_dump_test assign
318 }
319 run_dump_test sleb128
320
321 # .byte is 32 bits on tic4x, and .p2align isn't supported on tic54x
322 # .space is different on hppa*-hpux.
323 # MeP put bytes into packets.
324 if { ![istarget "tic4x*-*-*"] && ![istarget "tic54x*-*-*"] && ![istarget "hppa*-*-hpux*"] && ![istarget "mep*-*-*"] } {
325 run_dump_test relax
326 }
327
328 # .quad is 16 bytes on i960.
329 if { ![istarget "i960-*-*"] } {
330 run_dump_test quad
331 }
332
333
334 # .set works differently on some targets.
335 case $target_triplet in {
336 { alpha*-*-* } { }
337 { mips*-*-* } { }
338 { *c54x*-*-* } { }
339 { z80-*-* } { }
340 default {
341 run_dump_test weakref1
342 run_dump_test weakref1g
343 run_dump_test weakref1l
344 run_dump_test weakref1u
345 run_dump_test weakref1w
346 }
347 }
348 gas_test_error "weakref2.s" "" "e: would close weakref loop: e => a => b => c => d => e"
349 gas_test_error "weakref3.s" "" "a: would close weakref loop: a => b => c => d => e => a"
350 gas_test_error "weakref4.s" "" "is already defined"
351
352 run_dump_test string
353
354 load_lib gas-dg.exp
355 dg-init
356 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/err-*.s $srcdir/$subdir/warn-*.s]] "" ""
357 dg-finish
This page took 0.039193 seconds and 5 git commands to generate.