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