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