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