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