OSDN Git Service

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