1 # Copyright (C) 2012-2015 Free Software Foundation, Inc.
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.
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.
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.
18 # These tests should be valid on all targets.
21 # I think currently all targets fail this one when listings are enabled.
22 gas_test "p2425.s" "" "" "pcrel values in assignment"
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".
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
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
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.
38 if { [istarget hppa*-*-*] || [istarget *c54x*-*-*] || [istarget mep*-*-*]} then {
40 fail "simplifiable double subtraction"
42 gas_test "p1480.s" "" "-a>" "simplifiable double subtraction"
45 # No floating point support in assembly code for CRIS and Z80.
46 if { ![istarget cris-*-*] && ![istarget crisv32-*-*]
47 && ![istarget z80-*-*] } then {
48 gas_test "float.s" "" "" "simple FP constants"
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.
53 # The same is true for alpha-vms
55 # The MN10300 port supports link time relaxation which in turn allows
56 # for link time resolution of the differneces of two symbols which are
57 # undefined at assembly time. Hence this test will not pass for the
58 # MN10300. The same thing is true for the RX and AVR port as well.
59 if { ![istarget hppa*-*-*]
60 && ![istarget alpha*-*-*vms*]
61 && ![istarget avr-*-*]
63 && ![istarget mn10300-*-*]
64 && ![istarget msp430*-*-*]
65 && ![istarget am3*-*-*] } then {
66 gas_test_error "diff1.s" "" "difference of two undefined symbols"
69 gas_test_error "equiv1.s" "" ".equiv for symbol already set to another one"
70 gas_test_error "equiv2.s" "" ".equiv for symbol already set to an expression"
72 # .equ works differently on some targets.
73 case $target_triplet in {
77 gas_test "equ-ok.s" "" "" ".equ for symbol already set"
78 gas_test_error "equ-bad.s" "" ".equ for symbol already set through .eqv"
82 gas_test "eqv-ok.s" "" "" ".eqv support"
83 gas_test_error "eqv-bad.s" "" ".eqv for symbol already set"
85 if { ![istarget "bfin-*-*"] } then {
86 gas_test "assign-ok.s" "" "" "== assignment support"
88 gas_test_error "assign-bad.s" "" "== assignment for symbol already set"
90 # .equ works differently on some targets.
91 # linkrelax-ing prevents most forward references from working.
92 case $target_triplet in {
99 { mn10\[23\]00*-*-* } { }
101 # Some targets don't manage to resolve BFD_RELOC_8 for constants.
102 setup_xfail "alpha*-*-*" "*c30*-*-*" "*c4x*-*-*" \
103 "d\[13\]0v*-*-*" "i860-*-*" \
104 "nds32*-*-*" "pdp11-*-*" "xtensa*-*-*"
105 run_dump_test forward
109 # aout relocs are often weird, so is mep. don't bother testing
110 # som doesn't use a .text section
111 # mmix doesn't like .L1:
112 # ti addresses aren't octets.
113 if { ![is_aout_format] } {
114 case $target_triplet in {
118 { hppa*-*-hpux* } { }
131 # .set works differently on some targets.
132 # most of the tests won't work on targets that set linkrelax.
133 # 4 octet bytes confuse address matching on ti targets.
134 # pdp11 gets unexpected reloc types.
135 case $target_triplet in {
153 # These targets fail redef2 because they disallow redefined
155 setup_xfail "m68hc1*-*-*" "m6811-*-*" "m6812-*-*"
156 setup_xfail "rx-*-*" "vax*-*-*" "xgate*-*-*" "z8k-*-*"
158 setup_xfail "m68hc1*-*-*" "m6811-*-*" "m6812-*-*"
159 setup_xfail "rx-*-*" "vax*-*-*" "xgate*-*-*" "z8k-*-*"
160 # rs6000-aix disallows redefinition via .comm.
161 setup_xfail "*-*-aix*"
162 # SOM uses a different syntax for .comm
163 setup_xfail "hppa*-*-hpux*"
164 # These targets fail redef3 because section contents for the
165 # word referencing the .comm sym is not zero and/or its reloc
166 # has a non-zero addend. Relaxing the test would hide real
168 setup_xfail "bfin-*-*" "i\[3-7\]86-*-*coff" \
169 "i\[3-7\]86-*-*pe" "i\[3-7\]86-*-go32*" \
170 "i\[3-7\]86-*-cygwin*" "i\[3-7\]86-*-mingw*" "x86_64-*-mingw*"
172 gas_test_error "redef4.s" "" ".set for symbol already used as label"
173 gas_test_error "redef5.s" "" ".set for symbol already defined through .comm"
178 set testname "comment.s: comments in listings"
183 gas_start "comment.s" "-al"
185 # Apparently CRLF is received when using ptys for subprocesses; hence the
188 -re "^ +1\[ \t\]+# This\[^\n\]*\n" { set x1 1 }
189 -re "^ +2\[ \t\]+# correctly\[^\n\]*\n" { set x2 1 }
190 -re "^ +3\[ \t\]+/. C comments too. ./\r?\r?\n" { set x3 1 }
192 timeout { perror "timeout\n"; break }
197 if [all_ones $x1 $x2 $x3] then { pass $testname } else { fail $testname }
200 # m32c pads out sections, even empty ones.
201 case $target_triplet in {
208 # This test checks the output of the -ag switch. It must detect at least
209 # the name of the input file, output file, and options passed.
210 proc general_info_section {} {
211 set testname "general info section in listings"
216 gas_start "comment.s" "-agn"
219 -re "^ \[^\n\]*\t: .*\-agn\[^\n\]*\n" { set x1 1 }
220 -re "^ \[^\n\]*\t: \[^\n\]*comment\.s\[^\n\]*\n" { set x2 1 }
221 -re "^ \[^\n\]*\t: a\.out\[^\n\]*\n" { set x3 1 }
223 timeout { perror "timeout\n"; break }
228 if [all_ones $x1 $x2 $x3] then { pass $testname } else { fail $testname }
234 # Test x930509a -- correct assembly of differences involving forward
239 set testname "difference between forward references"
241 gas_start "x930509.s" "-al"
243 # We need to accomodate both byte orders here.
244 # If ".long" means an 8-byte value on some target someday, this test will have
247 -re "^ +1 .... 00 ?00 ?00 ?00" { fail $testname; set x 1 }
248 -re "^ +1 .... 04 ?00 ?00 ?00" { pass $testname; set x 1 }
249 -re "^ +1 .... 00 ?00 ?00 ?04" { pass $testname; set x 1 }
251 timeout { perror "timeout\n"; break }
256 if !$x then { fail $testname }
259 # This test is meaningless for the PA and CR16/CRX: the difference of two
260 # symbols cannot be resolved by the assembler.
261 # C54x assembler (for compatibility) does not allow differences between
262 # forward references.
263 # C30 counts a four byte offset as a difference of one.
264 if { ![istarget hppa*-*-*] &&
265 ![istarget cr16*-*-*] &&
266 ![istarget crx*-*-*] &&
267 ![istarget *c30*-*-*] &&
268 ![istarget *c4x*-*-*] &&
269 ![istarget *c54x*-*-*] } then {
270 # the vax fails because VMS can apparently actually handle this
271 # case in relocs, so gas doesn't handle it itself.
272 # msp430 and mn10300 emit two relocs to handle the difference of two symbols.
273 setup_xfail "mn10300*-*-*" "msp430*-*-*" "vax*-*-vms*"
277 # ".struct" and ".align" have different meanings on c54x
278 # These directives are done in the c54x-specific tests instead
279 case $target_triplet in {
290 # '<' and '>' appear to have special meanings on the excluded targets
291 case $target_triplet in {
300 run_dump_test altmacro
301 # The second test is valid only when '!' is not a comment
302 # character (it is allowed to be a line comment character).
303 if [string match "" [lindex [gas_run excl.s "-o /dev/null" ""] 0]] {
304 run_dump_test altmac2
305 # Similarly this test does not work when ! is a line seperator.
311 # This test is for any COFF target.
312 # We omit the ARM toolchains because they define locals to
313 # start with '.', which eliminates .eos, .text etc from the output.
314 # Omit c54x, since .tag and .def mean something different on that target
315 if { ([istarget *-*-coff*] && ![istarget arm*-*-coff] && ![istarget *c4x*-*-coff] && ![istarget *c54x*-*-coff]) \
316 ||([istarget *-*-pe*] && ![istarget arm*-*-pe*]) \
317 || [istarget i*86-*-aix*] \
318 || [istarget i*86-*-sco*] \
319 || [istarget i*86-*-isc*] \
320 || [istarget i*86-*-go32*] \
321 || [istarget i*86-*-cygwin*] \
322 || [istarget x86_64-*-mingw*] \
323 || [istarget i*86-*-*nt] \
324 || [istarget i*86-*-interix*] \
325 || ([istarget i960-*-vxworks5.*] && ![istarget i960-*-vxworks5.0*]) } {
326 run_dump_test cofftag
329 # Test omitting conditionals from listings.
335 set testname "conditional listings"
336 gas_run cond.s "-alc" ">dump.out"
337 if ![string match "" $comp_output] {
338 send_log "$comp_output\n"
341 if { [regexp_diff dump.out $srcdir/$subdir/cond.l] } {
349 # This test is not suitable for the PA for various reasons
350 # not limited to the fact that it depends on specific section
351 # names appearing in the output file.
352 # again, p2align doesn't work on c54x target
353 case $target_triplet in {
360 remote_download host "$srcdir/$subdir/incbin.dat"
365 if { ([istarget "i*86-*-*pe*"] && ![istarget "i*86-*-openbsd*"]) \
366 || [istarget "i*86-*-cygwin*"] \
367 || [istarget "i*86-*-mingw32*"] } {
368 gas_test "fastcall.s" "" "" "fastcall labels"
371 if { ![istarget "bfin-*-*"] && ![istarget "nds32*-*-*"] } then {
374 run_dump_test sleb128
375 run_dump_test sleb128-2
376 run_dump_test sleb128-3
377 setup_xfail "nds32*-*-*"
378 run_dump_test sleb128-4
379 run_dump_test sleb128-5
380 # .byte is not 8 bits on either tic4x or tic54x
381 if { ![istarget "tic4x*-*-*"] && ![istarget "tic54x*-*-*"] } {
382 run_dump_test sleb128-7
385 # .byte is 32 bits on tic4x, and .p2align isn't supported on tic54x
386 # .space is different on hppa*-hpux.
387 # MeP put bytes into packets.
388 if { ![istarget "tic4x*-*-*"] && ![istarget "tic54x*-*-*"] && ![istarget "hppa*-*-hpux*"] && ![istarget "mep*-*-*"] } {
392 # powerpc and s390 allow a string argument to .byte
393 if { ![istarget "powerpc*-*-*"] && ![istarget "rs6000*-*-*"] && ![istarget "s390*-*-*"] } {
397 # .quad is 16 bytes on i960.
398 if { ![istarget "i960-*-*"] } {
402 # som doesn't use .data section.
403 case $target_triplet in {
407 { hppa*-*-hpux* } { }
413 # .set works differently on some targets.
414 case $target_triplet in {
420 setup_xfail "nds32*-*-*"
421 run_dump_test weakref1
422 run_dump_test weakref1g
423 run_dump_test weakref1l
424 run_dump_test weakref1u
425 run_dump_test weakref1w
428 gas_test_error "weakref2.s" "" "e: would close weakref loop: e => a => b => c => d => e"
429 gas_test_error "weakref3.s" "" "a: would close weakref loop: a => b => c => d => e => a"
430 gas_test_error "weakref4.s" "" "is already defined"
439 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/err-*.s $srcdir/$subdir/warn-*.s]] "" ""