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