* write.c (install_reloc): Correct EMIT_SECTION_SYMBOLS test.
[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.
84case $target_triplet in {
85 { alpha*-*-* } { }
9497f5ac
NC
86 { mips*-*-* } { }
87 { *c54x*-*-* } { }
3c9b82ba 88 { z80-*-* } { }
9497f5ac 89 default {
b3f5a76b 90 setup_xfail "*c30*-*-*" "*c4x*-*-*" "pdp11-*-*" "xtensa*-*-*"
9497f5ac 91 run_dump_test redef
7b5030c0
NC
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
92757bc9
JB
96 setup_xfail "*c30*-*-*" "*c4x*-*-*" "*arm*-*-*aout*" "*arm*-*-*coff" \
97 "*arm*-*-pe" "crx*-*-*" "h8300*-*-*" "m68hc*-*-*" "maxq-*-*" \
3d3d428f 98 "mn10300-*-*" "pdp11-*-*" "vax*-*-*" "z8k-*-*" "cr16-*-*"
5ca0ee01 99 run_dump_test redef2
92757bc9 100 setup_xfail "*-*-aix*" "*-*-coff" "*-*-cygwin" "*-*-mingw*" "*-*-pe*" \
6745c726 101 "bfin-*-*" "*c4x*-*-*" "crx*-*-*" "h8300*-*-*" "hppa*-*-hpux*" \
7b5030c0 102 "m68hc*-*-*" "maxq-*-*" "mn10300-*-*" "or32-*-*" "pdp11-*-*" \
3d3d428f 103 "vax*-*-*" "z8k-*-*" "cr16-*-*"
92757bc9
JB
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"
9497f5ac
NC
109 }
110}
111
252b5132
RH
112proc 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 }
7f6a71ff 125 -re "^ +3\[ \t\]+/. C comments too. ./\r?\r?\n" { set x3 1 }
252b5132
RH
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
135do_comment
136
83f10cb2
NC
137# This test checks the output of the -ag switch. It must detect at least
138# the name of the input file, output file, and options passed.
139proc general_info_section {} {
140 set testname "general info section in listings"
141 set x1 0
142 set x2 0
143 set x3 0
144 set white {[ \t]*}
145 gas_start "comment.s" "-agn"
146 while 1 {
147 expect {
148 -re "^ \[^\n\]*\t: \-agn\[^\n\]*\n" { set x1 1 }
149 -re "^ \[^\n\]*\t: \[^\n\]*comment\.s\[^\n\]*\n" { set x2 1 }
150 -re "^ \[^\n\]*\t: a\.out\[^\n\]*\n" { set x3 1 }
151 -re "\[^\n\]*\n" { }
152 timeout { perror "timeout\n"; break }
153 eof { break }
154 }
155 }
156 gas_finish
157 if [all_ones $x1 $x2 $x3] then { pass $testname } else { fail $testname }
158}
159
160general_info_section
161
252b5132
RH
162#
163# Test x930509a -- correct assembly of differences involving forward
164# references.
165#
166
167proc do_930509a {} {
168 set testname "difference between forward references"
169 set x 0
170 gas_start "x930509.s" "-al"
171 while 1 {
172# We need to accomodate both byte orders here.
173# If ".long" means an 8-byte value on some target someday, this test will have
174# to be fixed.
175 expect {
224de7a5
AM
176 -re "^ +1 .... 00 ?00 ?00 ?00" { fail $testname; set x 1 }
177 -re "^ +1 .... 04 ?00 ?00 ?00" { pass $testname; set x 1 }
178 -re "^ +1 .... 00 ?00 ?00 ?04" { pass $testname; set x 1 }
252b5132
RH
179 -re "\[^\n\]*\n" { }
180 timeout { perror "timeout\n"; break }
181 eof { break }
182 }
183 }
184 gas_finish
185 if !$x then { fail $testname }
186}
187
3ccac826
NC
188# This test is meaningless for the PA and CR16/CRX: the difference of two
189# symbols cannot be resolved by the assembler.
39bec121 190# C54x assembler (for compatibility) does not allow differences between
3ccac826 191# forward references.
8bda4946 192# C30 counts a four byte offset as a difference of one.
48c5eb8a 193if { ![istarget hppa*-*-*] &&
3ccac826 194 ![istarget cr16*-*-*] &&
670ec21d 195 ![istarget crx*-*-*] &&
48c5eb8a
SS
196 ![istarget *c30*-*-*] &&
197 ![istarget *c4x*-*-*] &&
198 ![istarget *c54x*-*-*] } then {
252b5132
RH
199 # the vax fails because VMS can apparently actually handle this
200 # case in relocs, so gas doesn't handle it itself.
8bda4946 201 setup_xfail "h8300*-*-elf*" "mn10200*-*-*" "mn10300*-*-*" "vax*-*-vms*"
252b5132
RH
202 do_930509a
203}
204
39bec121
TW
205# ".struct" and ".align" have different meanings on c54x
206# These directives are done in the c54x-specific tests instead
252b5132
RH
207case $target_triplet in {
208 { hppa*-*-* } { }
48c5eb8a 209 { *c4x*-*-* } { }
39bec121 210 { *c54x*-*-* } { }
252b5132
RH
211 default {
212 run_dump_test struct
213 run_dump_test align
76101304 214 run_dump_test align2
252b5132
RH
215 }
216}
217
5069eab2
NC
218# '<' and '>' appear to have special meanings on the excluded targets
219case $target_triplet in {
5069eab2
NC
220 { frv-*-* } { }
221 { hppa*-*-* } { }
222 { m32r-*-* } { }
223 { mmix-*-* } { }
224 { *c4x*-*-* } { }
225 { *c54x*-*-* } { }
8df55cb8 226 { bfin-*-* } { }
5069eab2
NC
227 default {
228 run_dump_test altmacro
229 # The second test is valid only when '!' is not a comment
230 # character (it is allowed to be a line comment character).
26a78d4a 231 if [string match "" [lindex [gas_run excl.s "-o /dev/null" ""] 0]] {
5069eab2 232 run_dump_test altmac2
9497f5ac
NC
233 # Similarly this test does not work when ! is a line seperator.
234 run_dump_test eval
5069eab2
NC
235 }
236 }
237}
caa32fe5 238
252b5132 239# This test is for any COFF target.
252b5132
RH
240# We omit the ARM toolchains because they define locals to
241# start with '.', which eliminates .eos, .text etc from the output.
39bec121 242# Omit c54x, since .tag and .def mean something different on that target
e627d9a0 243if { ([istarget *-*-coff*] && ![istarget *arm*-*-coff] && ![istarget thumb*-*-coff] && ![istarget xscale-*-coff] && ![istarget *c4x*-*-coff] && ![istarget *c54x*-*-coff]) \
252b5132 244 ||([istarget *-*-pe*] && ![istarget arm*-*-pe*] && ![istarget thumb*-*-pe*]) \
252b5132
RH
245 || [istarget i*86-*-aix*] \
246 || [istarget i*86-*-sco*] \
247 || [istarget i*86-*-isc*] \
248 || [istarget i*86-*-go32*] \
249 || [istarget i*86-*-cygwin*] \
42037fe5 250 || [istarget x86_64-*-mingw*] \
252b5132 251 || [istarget i*86-*-*nt] \
61feeec2 252 || [istarget i*86-*-interix*] \
252b5132
RH
253 || ([istarget i960-*-vxworks5.*] && ![istarget i960-*-vxworks5.0*]) } {
254 run_dump_test cofftag
255}
256
257# Test omitting conditionals from listings.
258proc test_cond {} {
259 global comp_output
260 global srcdir
261 global subdir
262
263 set testname "conditional listings"
224de7a5 264 gas_run cond.s "-alc" ">dump.out"
252b5132
RH
265 if ![string match "" $comp_output] {
266 send_log "$comp_output\n"
267 fail $testname
268 } else {
9497f5ac 269 if { [regexp_diff dump.out $srcdir/$subdir/cond.l] } {
252b5132
RH
270 fail $testname
271 } else {
272 pass $testname
273 }
274 }
275}
276
c8060cba
JL
277# This test is not suitable for the PA for various reasons
278# not limited to the fact that it depends on specific section
279# names appearing in the output file.
39bec121 280# again, p2align doesn't work on c54x target
aceebfd6
NC
281case $target_triplet in {
282 { hppa*-*-* } { }
48c5eb8a 283 { *c4x*-*-* } { }
aceebfd6
NC
284 { *c54x*-*-* } { }
285 default {
286 test_cond
7f6a71ff 287 remote_download host "$srcdir/$subdir/incbin.dat"
aceebfd6
NC
288 run_dump_test incbin
289 }
39bec121 290}
c9e38879 291
01ed09aa 292if { ([istarget "i*86-*-*pe*"] && ![istarget "i*86-*-openbsd*"]) \
b46c1691
NC
293 || [istarget "i*86-*-cygwin*"] \
294 || [istarget "i*86-*-mingw32*"] } {
295 gas_test "fastcall.s" "" "" "fastcall labels"
296}
a7eec876 297
6efba987 298run_dump_test assign
e5604d79 299run_dump_test sleb128
ddc07134 300
5e9ed83f 301# .byte is 32 bits on tic4x, and .p2align isn't supported on tic54x
17b939cd
DA
302# .space is different on hppa*-hpux.
303if { ![istarget "tic4x*-*-*"] && ![istarget "tic54x*-*-*"] && ![istarget "hppa*-*-hpux*"] } {
5e9ed83f
L
304 run_dump_test relax
305}
306
ddc07134
AM
307# .quad is 16 bytes on i960.
308if { ![istarget "i960-*-*"] } {
309 run_dump_test quad
310}
e5604d79 311
3c9b82ba
NC
312
313# .set works differently on some targets.
314case $target_triplet in {
92757bc9
JB
315 { alpha*-*-* } { }
316 { mips*-*-* } { }
317 { *c54x*-*-* } { }
3c9b82ba
NC
318 { z80-*-* } { }
319 default {
320 run_dump_test weakref1
321 run_dump_test weakref1g
322 run_dump_test weakref1l
323 run_dump_test weakref1u
324 run_dump_test weakref1w
325 }
326}
06e77878
AO
327gas_test_error "weakref2.s" "" "e: would close weakref loop: e => a => b => c => d => e"
328gas_test_error "weakref3.s" "" "a: would close weakref loop: a => b => c => d => e => a"
b54788f8 329gas_test_error "weakref4.s" "" "is already defined"
06e77878 330
38a57ae7
NC
331run_dump_test string
332
a7eec876
HPN
333load_lib gas-dg.exp
334dg-init
335dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/err-*.s $srcdir/$subdir/warn-*.s]] "" ""
336dg-finish
This page took 0.380171 seconds and 4 git commands to generate.