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