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