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