FT32B is a new FT32 family member. It has a code compression scheme, which requires...
[deliverable/binutils-gdb.git] / gas / testsuite / gas / all / gas.exp
CommitLineData
2571583a 1# Copyright (C) 2012-2017 Free Software Foundation, Inc.
5bf135a7
NC
2
3# This program is free software; you can redistribute it and/or modify
4# it under the terms of the GNU General Public License as published by
5# the Free Software Foundation; either version 3 of the License, or
6# (at your option) any later version.
7#
8# This program is distributed in the hope that it will be useful,
9# but WITHOUT ANY WARRANTY; without even the implied warranty of
10# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11# GNU General Public License for more details.
12#
13# You should have received a copy of the GNU General Public License
14# along with this program; if not, write to the Free Software
15# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
16
252b5132
RH
17#
18# These tests should be valid on all targets.
19#
20
21# I think currently all targets fail this one when listings are enabled.
22gas_test "p2425.s" "" "" "pcrel values in assignment"
23
24# p1480.s uses a ".space" directive which for most assemblers means
25# "allocate some space". On the PA it means "switch into this space".
26#
27# Therefore this test (as it is currently written) is completely bogus
28# for any PA target. Do not bother trying to run it and just claim
29# it fails.
39bec121
TW
30#
31# The C54x uses ".space" to allocate bits, and requires absolute expressions;
32# The ".space" directive is taken care of in the C54x-specific tests, so fail
33# here
34#
280d71bf
DB
35# The test also doesn't work on mep targets, since they use RELC, and it
36# will avoid simplifying the expression since it conservatively assumes
37# ugly expressions can be saved until link-time.
38if { [istarget hppa*-*-*] || [istarget *c54x*-*-*] || [istarget mep*-*-*]} then {
252b5132
RH
39 setup_xfail *-*-*
40 fail "simplifiable double subtraction"
41} else {
42 gas_test "p1480.s" "" "-a>" "simplifiable double subtraction"
43}
44
3c9b82ba
NC
45# No floating point support in assembly code for CRIS and Z80.
46if { ![istarget cris-*-*] && ![istarget crisv32-*-*]
47 && ![istarget z80-*-*] } then {
483f05e3
HPN
48 gas_test "float.s" "" "" "simple FP constants"
49}
252b5132
RH
50
51# This test is meaningless for the PA; the difference of two undefined
52# symbols is something that is (and must be) supported on the PA.
3ee6e4fb 53# The same is true for ALPHA-VMS.
569006e5 54#
3ee6e4fb
NC
55# The AVR, MICROBLAZE, MN10300, RL78 and RX ports all support link time
56# relaxation, which in turn allows for link time resolution of the
57# differences of two previously undefined symbols. Hence this test will
58# not pass for these targets.
59if { ![istarget alpha*-*-*vms*]
60 && ![istarget am3*-*-*]
edc9e9a6 61 && ![istarget avr-*-*]
81b42bca 62 && ![istarget ft32-*-*]
3ee6e4fb
NC
63 && ![istarget hppa*-*-*]
64 && ![istarget microblaze-*-*]
c7927a3c 65 && ![istarget mn10300-*-*]
13761a11 66 && ![istarget msp430*-*-*]
8dfa5d5a 67 && ![istarget riscv*-*-*]
3ee6e4fb
NC
68 && ![istarget rl78-*-*]
69 && ![istarget rx-*-*] } then {
252b5132
RH
70 gas_test_error "diff1.s" "" "difference of two undefined symbols"
71}
72
9497f5ac
NC
73gas_test_error "equiv1.s" "" ".equiv for symbol already set to another one"
74gas_test_error "equiv2.s" "" ".equiv for symbol already set to an expression"
75
76# .equ works differently on some targets.
77case $target_triplet in {
78 { hppa*-*-* } { }
79 { *c54x*-*-* } { }
80 default {
81 gas_test "equ-ok.s" "" "" ".equ for symbol already set"
82 gas_test_error "equ-bad.s" "" ".equ for symbol already set through .eqv"
83 }
84}
85
86gas_test "eqv-ok.s" "" "" ".eqv support"
87gas_test_error "eqv-bad.s" "" ".eqv for symbol already set"
88
3f904b16
AM
89if { ![istarget "bfin-*-*"] } then {
90 gas_test "assign-ok.s" "" "" "== assignment support"
91}
9497f5ac
NC
92gas_test_error "assign-bad.s" "" "== assignment for symbol already set"
93
94# .equ works differently on some targets.
95# linkrelax-ing prevents most forward references from working.
96case $target_triplet in {
75800d2c 97 { am3*-*-* } { }
ec0c103c 98 { *c54x*-*-* } { }
3ccac826 99 { cr16*-*-* } { }
9497f5ac
NC
100 { crx*-*-* } { }
101 { h8300*-*-* } { }
102 { hppa*-*-* } { }
ec0c103c 103 { mep-*-* } { }
3ee6e4fb 104 { microblaze-*-* } { }
9497f5ac 105 { mn10\[23\]00*-*-* } { }
9497f5ac
NC
106 default {
107 # Some targets don't manage to resolve BFD_RELOC_8 for constants.
c4990c4b 108 setup_xfail "alpha*-*-*" "*c30*-*-*" "*c4x*-*-*" \
d56a8dda 109 "d\[13\]0v*-*-*" "i860-*-*" \
35c08157 110 "nds32*-*-*" "pdp11-*-*" "xtensa*-*-*"
9497f5ac
NC
111 run_dump_test forward
112 }
113}
114
e8044f35 115# aout relocs are often weird, so is mep. don't bother testing
f9022510
AM
116# som doesn't use a .text section
117# mmix doesn't like .L1:
118# ti addresses aren't octets.
119if { ![is_aout_format] } {
120 case $target_triplet in {
01c51e44
DA
121 { hppa*64*-*-* } {
122 run_dump_test fwdexp
123 }
3ee6e4fb
NC
124 { alpha-*-*linux*ecoff } { }
125 { alpha-*-osf* } { }
01c51e44 126 { hppa*-*-hpux* } { }
f9022510 127 { mep-*-* } { }
f9022510 128 { mmix-*-* } { }
35c08157 129 { nds32*-*-* } { }
f9022510
AM
130 { tic30*-*-* } { }
131 { tic4x*-*-* } { }
132 { tic54x*-*-* } { }
133 default {
134 run_dump_test fwdexp
135 }
136 }
137}
138
9497f5ac 139# .set works differently on some targets.
f42fb574
AM
140# most of the tests won't work on targets that set linkrelax.
141# 4 octet bytes confuse address matching on ti targets.
142# pdp11 gets unexpected reloc types.
9497f5ac
NC
143case $target_triplet in {
144 { alpha*-*-* } { }
75800d2c 145 { am3*-*-* } { }
f42fb574
AM
146 { cr16*-*-* } { }
147 { crx*-*-* } { }
148 { h8300-*-* } { }
9497f5ac 149 { mips*-*-* } { }
f42fb574
AM
150 { mn10200-*-* } { }
151 { mn10300-*-* } { }
13761a11 152 { msp430*-*-* } { }
35c08157 153 { nds32*-*-* } { }
f42fb574
AM
154 { pdp11-*-* } { }
155 { tic30*-*-* } { }
156 { tic4x*-*-* } { }
157 { tic54x*-*-* } { }
158 { xtensa*-*-* } { }
3c9b82ba 159 { z80-*-* } { }
9497f5ac 160 default {
9497f5ac 161 run_dump_test redef
3ee6e4fb 162 setup_xfail "arm-epoc-pe*"
8b0aac0f
AM
163 # These targets fail redef2 because they disallow redefined
164 # symbols on relocs.
3ee6e4fb 165 setup_xfail "m68hc1*-*-*" "m6811-*-*" "m6812-*-*" "rl78-*-*"
e23eba97 166 setup_xfail "riscv*-*-*" "rx-*-*" "vax*-*-*" "xgate*-*-*" "z8k-*-*"
5ca0ee01 167 run_dump_test redef2
3ee6e4fb 168 setup_xfail "m68hc1*-*-*" "m6811-*-*" "m6812-*-*" "rl78-*-*"
e23eba97 169 setup_xfail "riscv*-*-*" "rx-*-*" "vax*-*-*" "xgate*-*-*" "z8k-*-*"
8b0aac0f
AM
170 # rs6000-aix disallows redefinition via .comm.
171 setup_xfail "*-*-aix*"
172 # SOM uses a different syntax for .comm
173 setup_xfail "hppa*-*-hpux*"
174 # These targets fail redef3 because section contents for the
175 # word referencing the .comm sym is not zero and/or its reloc
176 # has a non-zero addend. Relaxing the test would hide real
73589c9d 177 # failures.
8b0aac0f
AM
178 setup_xfail "bfin-*-*" "i\[3-7\]86-*-*coff" \
179 "i\[3-7\]86-*-*pe" "i\[3-7\]86-*-go32*" \
3ee6e4fb
NC
180 "i\[3-7\]86-*-cygwin*" "i\[3-7\]86-*-mingw*" \
181 "x86_64-*-cygwin*" "x86_64-*-mingw*"
92757bc9 182 run_dump_test redef3
92757bc9 183 gas_test_error "redef4.s" "" ".set for symbol already used as label"
92757bc9 184 gas_test_error "redef5.s" "" ".set for symbol already defined through .comm"
9497f5ac
NC
185 }
186}
187
252b5132
RH
188proc do_comment {} {
189 set testname "comment.s: comments in listings"
190 set x1 0
191 set x2 0
192 set x3 0
193 set white {[ \t]*}
194 gas_start "comment.s" "-al"
195 while 1 {
196# Apparently CRLF is received when using ptys for subprocesses; hence the
197# \r\n for line 3.
198 expect {
199 -re "^ +1\[ \t\]+# This\[^\n\]*\n" { set x1 1 }
200 -re "^ +2\[ \t\]+# correctly\[^\n\]*\n" { set x2 1 }
7f6a71ff 201 -re "^ +3\[ \t\]+/. C comments too. ./\r?\r?\n" { set x3 1 }
252b5132
RH
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
bad6899a
AM
211# m32c pads out sections, even empty ones.
212case $target_triplet in {
213 { m32c-*-* } { }
214 default {
215 do_comment
216 }
217}
252b5132 218
83f10cb2
NC
219# This test checks the output of the -ag switch. It must detect at least
220# the name of the input file, output file, and options passed.
221proc general_info_section {} {
222 set testname "general info section in listings"
223 set x1 0
224 set x2 0
225 set x3 0
226 set white {[ \t]*}
227 gas_start "comment.s" "-agn"
228 while 1 {
229 expect {
c7927a3c 230 -re "^ \[^\n\]*\t: .*\-agn\[^\n\]*\n" { set x1 1 }
83f10cb2
NC
231 -re "^ \[^\n\]*\t: \[^\n\]*comment\.s\[^\n\]*\n" { set x2 1 }
232 -re "^ \[^\n\]*\t: a\.out\[^\n\]*\n" { set x3 1 }
233 -re "\[^\n\]*\n" { }
234 timeout { perror "timeout\n"; break }
235 eof { break }
236 }
237 }
238 gas_finish
239 if [all_ones $x1 $x2 $x3] then { pass $testname } else { fail $testname }
240}
241
242general_info_section
243
252b5132
RH
244#
245# Test x930509a -- correct assembly of differences involving forward
246# references.
247#
248
249proc do_930509a {} {
250 set testname "difference between forward references"
251 set x 0
252 gas_start "x930509.s" "-al"
253 while 1 {
c29ae970 254# We need to accommodate both byte orders here.
252b5132
RH
255# If ".long" means an 8-byte value on some target someday, this test will have
256# to be fixed.
257 expect {
224de7a5
AM
258 -re "^ +1 .... 00 ?00 ?00 ?00" { fail $testname; set x 1 }
259 -re "^ +1 .... 04 ?00 ?00 ?00" { pass $testname; set x 1 }
260 -re "^ +1 .... 00 ?00 ?00 ?04" { pass $testname; set x 1 }
252b5132
RH
261 -re "\[^\n\]*\n" { }
262 timeout { perror "timeout\n"; break }
263 eof { break }
264 }
265 }
266 gas_finish
267 if !$x then { fail $testname }
268}
269
3ccac826
NC
270# This test is meaningless for the PA and CR16/CRX: the difference of two
271# symbols cannot be resolved by the assembler.
39bec121 272# C54x assembler (for compatibility) does not allow differences between
3ccac826 273# forward references.
8bda4946 274# C30 counts a four byte offset as a difference of one.
3ee6e4fb
NC
275if { ![istarget *c30*-*-*]
276 && ![istarget *c4x*-*-*]
277 && ![istarget *c54x*-*-*]
278 && ![istarget cr16*-*-*]
279 && ![istarget crx*-*-*]
81b42bca 280 && ![istarget ft32-*-*]
3ee6e4fb
NC
281 && ![istarget h8300*-*-*]
282 && ![istarget hppa*-*-*] } then {
283 # The vax fails because VMS can apparently actually handle this
252b5132 284 # case in relocs, so gas doesn't handle it itself.
e23eba97 285 # msp430, mn10[23]00 and riscv emit two relocs to handle the difference of two symbols.
75800d2c 286 setup_xfail "am3*-*-*" "mn10200-*-*" "mn10300*-*-*" "msp430*-*-*" "riscv*-*-*" "vax*-*-vms*"
252b5132
RH
287 do_930509a
288}
289
39bec121
TW
290# ".struct" and ".align" have different meanings on c54x
291# These directives are done in the c54x-specific tests instead
252b5132
RH
292case $target_triplet in {
293 { hppa*-*-* } { }
48c5eb8a 294 { *c4x*-*-* } { }
39bec121 295 { *c54x*-*-* } { }
252b5132
RH
296 default {
297 run_dump_test struct
298 run_dump_test align
3ee6e4fb 299 setup_xfail "ns32k-*-*"
76101304 300 run_dump_test align2
252b5132
RH
301 }
302}
303
5069eab2
NC
304# '<' and '>' appear to have special meanings on the excluded targets
305case $target_triplet in {
5069eab2
NC
306 { frv-*-* } { }
307 { hppa*-*-* } { }
308 { m32r-*-* } { }
309 { mmix-*-* } { }
310 { *c4x*-*-* } { }
311 { *c54x*-*-* } { }
8df55cb8 312 { bfin-*-* } { }
5069eab2
NC
313 default {
314 run_dump_test altmacro
315 # The second test is valid only when '!' is not a comment
316 # character (it is allowed to be a line comment character).
26a78d4a 317 if [string match "" [lindex [gas_run excl.s "-o /dev/null" ""] 0]] {
5069eab2 318 run_dump_test altmac2
c29ae970 319 # Similarly this test does not work when ! is a line separator.
9497f5ac 320 run_dump_test eval
5069eab2
NC
321 }
322 }
323}
caa32fe5 324
252b5132 325# This test is for any COFF target.
252b5132
RH
326# We omit the ARM toolchains because they define locals to
327# start with '.', which eliminates .eos, .text etc from the output.
39bec121 328# Omit c54x, since .tag and .def mean something different on that target
8c5fc800
JM
329if { ([istarget *-*-coff*] && ![istarget arm*-*-coff] && ![istarget *c4x*-*-coff] && ![istarget *c54x*-*-coff]) \
330 ||([istarget *-*-pe*] && ![istarget arm*-*-pe*]) \
252b5132
RH
331 || [istarget i*86-*-aix*] \
332 || [istarget i*86-*-sco*] \
333 || [istarget i*86-*-isc*] \
334 || [istarget i*86-*-go32*] \
335 || [istarget i*86-*-cygwin*] \
42037fe5 336 || [istarget x86_64-*-mingw*] \
252b5132 337 || [istarget i*86-*-*nt] \
61feeec2 338 || [istarget i*86-*-interix*] \
252b5132
RH
339 || ([istarget i960-*-vxworks5.*] && ![istarget i960-*-vxworks5.0*]) } {
340 run_dump_test cofftag
341}
342
343# Test omitting conditionals from listings.
344proc test_cond {} {
345 global comp_output
346 global srcdir
347 global subdir
348
349 set testname "conditional listings"
224de7a5 350 gas_run cond.s "-alc" ">dump.out"
252b5132
RH
351 if ![string match "" $comp_output] {
352 send_log "$comp_output\n"
353 fail $testname
354 } else {
eb22018c 355 if { [regexp_diff dump.out $srcdir/$subdir/cond.l] } {
252b5132
RH
356 fail $testname
357 } else {
358 pass $testname
359 }
360 }
361}
362
c8060cba
JL
363# This test is not suitable for the PA for various reasons
364# not limited to the fact that it depends on specific section
365# names appearing in the output file.
3ee6e4fb 366# Again, p2align doesn't work on c54x and related targets.
aceebfd6 367case $target_triplet in {
3ee6e4fb
NC
368 { alpha-*-linux*ecoff} { }
369 { alpha-*-osf*} { }
aceebfd6 370 { hppa*-*-* } { }
48c5eb8a 371 { *c4x*-*-* } { }
aceebfd6 372 { *c54x*-*-* } { }
3ee6e4fb 373 { rl78-*-* } { }
c7927a3c 374 { rx-*-* } { }
aceebfd6
NC
375 default {
376 test_cond
7f6a71ff 377 remote_download host "$srcdir/$subdir/incbin.dat"
aceebfd6
NC
378 run_dump_test incbin
379 }
39bec121 380}
c9e38879 381
01ed09aa 382if { ([istarget "i*86-*-*pe*"] && ![istarget "i*86-*-openbsd*"]) \
b46c1691
NC
383 || [istarget "i*86-*-cygwin*"] \
384 || [istarget "i*86-*-mingw32*"] } {
385 gas_test "fastcall.s" "" "" "fastcall labels"
386}
a7eec876 387
35c08157 388if { ![istarget "bfin-*-*"] && ![istarget "nds32*-*-*"] } then {
3f904b16
AM
389 run_dump_test assign
390}
e5604d79 391run_dump_test sleb128
956a6ba3
JB
392run_dump_test sleb128-2
393run_dump_test sleb128-3
35c08157 394setup_xfail "nds32*-*-*"
956a6ba3
JB
395run_dump_test sleb128-4
396run_dump_test sleb128-5
4455e9ad
JB
397# .byte is not 8 bits on either tic4x or tic54x
398if { ![istarget "tic4x*-*-*"] && ![istarget "tic54x*-*-*"] } {
399 run_dump_test sleb128-7
1a94eb29 400 run_dump_test sleb128-8
4455e9ad 401}
ba8826a8 402run_dump_test sleb128-9
ddc07134 403
5e9ed83f 404# .byte is 32 bits on tic4x, and .p2align isn't supported on tic54x
17b939cd 405# .space is different on hppa*-hpux.
ec0c103c
NC
406# MeP put bytes into packets.
407if { ![istarget "tic4x*-*-*"] && ![istarget "tic54x*-*-*"] && ![istarget "hppa*-*-hpux*"] && ![istarget "mep*-*-*"] } {
5e9ed83f
L
408 run_dump_test relax
409}
410
af47cd43
AK
411# powerpc and s390 allow a string argument to .byte
412if { ![istarget "powerpc*-*-*"] && ![istarget "rs6000*-*-*"] && ![istarget "s390*-*-*"] } {
9e59393e
AM
413 run_dump_test byte
414}
847d4311 415
ddc07134
AM
416# .quad is 16 bytes on i960.
417if { ![istarget "i960-*-*"] } {
418 run_dump_test quad
419}
e5604d79 420
01c51e44
DA
421# som doesn't use .data section.
422case $target_triplet in {
423 { hppa*64*-*-* } {
424 run_dump_test octa
425 }
426 { hppa*-*-hpux* } { }
427 default {
428 run_dump_test octa
429 }
430}
3c9b82ba
NC
431
432# .set works differently on some targets.
433case $target_triplet in {
92757bc9
JB
434 { alpha*-*-* } { }
435 { mips*-*-* } { }
436 { *c54x*-*-* } { }
3c9b82ba
NC
437 { z80-*-* } { }
438 default {
35c08157 439 setup_xfail "nds32*-*-*"
3c9b82ba
NC
440 run_dump_test weakref1
441 run_dump_test weakref1g
442 run_dump_test weakref1l
443 run_dump_test weakref1u
444 run_dump_test weakref1w
445 }
446}
06e77878
AO
447gas_test_error "weakref2.s" "" "e: would close weakref loop: e => a => b => c => d => e"
448gas_test_error "weakref3.s" "" "a: would close weakref loop: a => b => c => d => e => a"
b54788f8 449gas_test_error "weakref4.s" "" "is already defined"
06e77878 450
38a57ae7 451run_dump_test string
740bdc67
AM
452if [is_elf_format] {
453 run_dump_test none
454}
38a57ae7 455
d02603dc
NC
456run_dump_test quoted-sym-names
457
93a24ba7
MR
458run_list_test pr20312
459
a7eec876
HPN
460load_lib gas-dg.exp
461dg-init
462dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/err-*.s $srcdir/$subdir/warn-*.s]] "" ""
463dg-finish
9875b365
MR
464
465# Set $nop_type appropriately to indicate the NOP instruction mnemonic.
466case $target_triplet in {
467 { "mmix-*-*" } {
468 set nop_type 5
469 }
470 { "i960-*-*" } {
471 set nop_type 4
472 }
473 { "i370-*-*" } {
474 set nop_type 3
475 }
476 { "or1k*-*-*" } {
477 set nop_type 2
478 }
479 { "ia64-*-*" } {
480 set nop_type 1
481 }
482 default {
483 set nop_type 0
484 }
485}
486run_dump_test "org-1" [list [list as "--defsym nop_type=$nop_type"]]
487run_dump_test "org-2"
488run_dump_test "org-3"
489run_dump_test "org-4"
490run_dump_test "org-5"
491run_dump_test "org-6"
4f2358bc 492
fa57faa0 493run_dump_test "fill-1"
This page took 0.839953 seconds and 4 git commands to generate.