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