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