bfd
[deliverable/binutils-gdb.git] / gas / testsuite / gas / all / gas.exp
index 8098448ce93a21b6d4bce292a4a9ff9a82c12078..80082367eb631f00ccf7aa325f04e4b43979fea3 100644 (file)
@@ -16,21 +16,114 @@ gas_test "p2425.s" ""   "" "pcrel values in assignment"
 # The ".space" directive is taken care of in the C54x-specific tests, so fail
 #  here 
 #
-if { [istarget hppa*-*-*] || [istarget *c54x*-*-*] } then {
+# The test also doesn't work on mep targets, since they use RELC, and it
+# will avoid simplifying the expression since it conservatively assumes
+# ugly expressions can be saved until link-time.
+if { [istarget hppa*-*-*] || [istarget *c54x*-*-*] || [istarget mep*-*-*]} then {
     setup_xfail *-*-*
     fail "simplifiable double subtraction"
 } else {
     gas_test "p1480.s" "" "-a>" "simplifiable double subtraction"
 }
 
-gas_test "float.s" ""   "" "simple FP constants"
+# No floating point support in assembly code for CRIS and Z80.
+if { ![istarget cris-*-*] && ![istarget crisv32-*-*] 
+     && ![istarget z80-*-*] } then {
+    gas_test "float.s" ""   "" "simple FP constants"
+}
 
 # This test is meaningless for the PA; the difference of two undefined
 # symbols is something that is (and must be) supported on the PA.
-if ![istarget hppa*-*-*] then {
+#
+# The MN10300 port supports link time relaxation which in turn allows
+# for link time resolution of the differneces of two symbols which are
+# undefined at assembly time.  Hence this test will not pass for the
+# MN10300.  The same thing is true for the RX port as well.
+if { ![istarget hppa*-*-*]
+     && ![istarget rx-*-*]
+     && ![istarget mn10300-*-*]
+     && ![istarget am3*-*-*] } then {
     gas_test_error "diff1.s" "" "difference of two undefined symbols"
 }
 
+gas_test_error "equiv1.s" "" ".equiv for symbol already set to another one"
+gas_test_error "equiv2.s" "" ".equiv for symbol already set to an expression"
+
+# .equ works differently on some targets.
+case $target_triplet in {
+    { hppa*-*-* } { }
+    { *c54x*-*-* } { }
+    default {
+       gas_test "equ-ok.s" "" "" ".equ for symbol already set"
+       gas_test_error "equ-bad.s" "" ".equ for symbol already set through .eqv"
+    }
+}
+
+gas_test "eqv-ok.s" "" "" ".eqv support"
+gas_test_error "eqv-bad.s" "" ".eqv for symbol already set"
+
+if { ![istarget "bfin-*-*"] } then {
+    gas_test "assign-ok.s" "" "" "== assignment support"
+}
+gas_test_error "assign-bad.s" "" "== assignment for symbol already set"
+
+# .equ works differently on some targets.
+# linkrelax-ing prevents most forward references from working.
+case $target_triplet in {
+    { *c54x*-*-* } { }
+    { cr16*-*-* } { }
+    { crx*-*-* } { }
+    { h8300*-*-* } { }
+    { hppa*-*-* } { }
+    { mep-*-* } { }
+    { mn10\[23\]00*-*-* } { }
+    default {
+       # Some targets don't manage to resolve BFD_RELOC_8 for constants.
+       setup_xfail "alpha*-*-*" "avr-*-*" "*c30*-*-*" "*c4x*-*-*" \
+           "d\[13\]0v*-*-*" "i860-*-*" "mips*-*-*" "msp430-*-*" \
+           "pdp11-*-*" "sparc*-*-*" "xtensa*-*-*"
+       run_dump_test forward
+    }
+}
+
+# .set works differently on some targets.
+# most of the tests won't work on targets that set linkrelax.
+# 4 octet bytes confuse address matching on ti targets.
+# pdp11 gets unexpected reloc types.
+case $target_triplet in {
+    { alpha*-*-* } { }
+    { cr16*-*-* } { }
+    { crx*-*-* } { }
+    { h8300-*-* } { }
+    { mips*-*-* } { }
+    { mn10200-*-* } { }
+    { mn10300-*-* } { }
+    { pdp11-*-* } { }
+    { tic30*-*-* } { }
+    { tic4x*-*-* } { }
+    { tic54x*-*-* } { }
+    { xtensa*-*-* } { }
+    { z80-*-* } { }
+    default {
+       run_dump_test redef
+       # The next two tests can fail if the target does not convert fixups
+       # against ordinary symbols into relocations against section symbols.
+       # This is usually revealed by the error message:
+       #  symbol `sym' required but not present
+       setup_xfail "*arm*-*-*aout*" "*arm*-*-*coff" \
+           "*arm*-*-pe" "m68hc*-*-*" "maxq-*-*" \
+           "rx-*-*" "vax*-*-*" "z8k-*-*"
+       run_dump_test redef2
+       setup_xfail "*-*-aix*" "*-*-coff" "*-*-cygwin" "*-*-mingw*" "*-*-pe*" \
+           "bfin-*-*" "hppa*-*-hpux*" \
+           "m68hc*-*-*" "maxq-*-*" "or32-*-*" \
+           "rx-*-*" "vax*-*-*" "z8k-*-*"
+       run_dump_test redef3
+       gas_test_error "redef4.s" "" ".set for symbol already used as label"
+       gas_test_error "redef5.s" "" ".set for symbol already defined through .comm"
+    }
+}
+
 proc do_comment {} {
     set testname "comment.s: comments in listings"
     set x1 0
@@ -44,7 +137,7 @@ proc do_comment {} {
        expect {
            -re "^ +1\[ \t\]+# This\[^\n\]*\n"          { set x1 1 }
            -re "^ +2\[ \t\]+# correctly\[^\n\]*\n"     { set x2 1 }
-           -re "^ +3\[ \t\]+/. C comments too. ./\r?\n" { set x3 1 }
+           -re "^ +3\[ \t\]+/. C comments too. ./\r?\r?\n" { set x3 1 }
            -re "\[^\n\]*\n"                            { }
            timeout                             { perror "timeout\n"; break }
            eof                                 { break }
@@ -54,7 +147,38 @@ proc do_comment {} {
     if [all_ones $x1 $x2 $x3] then { pass $testname } else { fail $testname }
 }
 
-do_comment
+# m32c pads out sections, even empty ones.
+case $target_triplet in {
+    { m32c-*-* } { }
+    default {
+       do_comment
+    }
+}
+
+# This test checks the output of the -ag switch. It must detect at least
+# the name of the input file, output file, and options passed.
+proc general_info_section {} {
+    set testname "general info section in listings"
+    set x1 0
+    set x2 0
+    set x3 0
+    set white {[ \t]*}
+    gas_start "comment.s" "-agn"
+    while 1 {
+       expect {
+           -re "^ \[^\n\]*\t: .*\-agn\[^\n\]*\n"                { set x1 1 }
+           -re "^ \[^\n\]*\t: \[^\n\]*comment\.s\[^\n\]*\n"   { set x2 1 }
+           -re "^ \[^\n\]*\t: a\.out\[^\n\]*\n"               { set x3 1 }
+           -re "\[^\n\]*\n"     { }
+           timeout              { perror "timeout\n"; break }
+           eof                  { break }
+       }
+    }
+    gas_finish
+    if [all_ones $x1 $x2 $x3] then { pass $testname } else { fail $testname }
+}
+
+general_info_section
 
 #
 # Test x930509a -- correct assembly of differences involving forward
@@ -82,16 +206,20 @@ proc do_930509a {} {
     if !$x then { fail $testname }
 }
 
-# This test is meaningless for the PA; the difference of two symbols
-# must not be resolved by the assembler.
+# This test is meaningless for the PA and CR16/CRX: the difference of two
+# symbols cannot be resolved by the assembler.
 # C54x assembler (for compatibility) does not allow differences between
-# forward references
-if { ![istarget hppa*-*-*] && ![istarget *c54x*-*-*] } then {
+# forward references.
+# C30 counts a four byte offset as a difference of one.
+if { ![istarget hppa*-*-*] &&
+     ![istarget cr16*-*-*] &&
+     ![istarget  crx*-*-*] &&
+     ![istarget *c30*-*-*] &&
+     ![istarget *c4x*-*-*] &&
+     ![istarget *c54x*-*-*] } then {
     # the vax fails because VMS can apparently actually handle this
     # case in relocs, so gas doesn't handle it itself.
-    setup_xfail "vax*-*-vms*"
-    setup_xfail "mn10300*-*-*"
-    setup_xfail "mn10200*-*-*"
+    setup_xfail "h8300*-*-elf*" "mn10200*-*-*" "mn10300*-*-*" "vax*-*-vms*"
     do_930509a
 }
 
@@ -99,29 +227,48 @@ if { ![istarget hppa*-*-*] && ![istarget *c54x*-*-*] } then {
 # These directives are done in the c54x-specific tests instead
 case $target_triplet in {
     { hppa*-*-* } { }
+    { *c4x*-*-* } { }
     { *c54x*-*-* } { }
     default {
        run_dump_test struct
        run_dump_test align
+       run_dump_test align2
+    }
+}
+
+# '<' and '>' appear to have special meanings on the excluded targets
+case $target_triplet in {
+    { frv-*-* } { }
+    { hppa*-*-* } { }
+    { m32r-*-* } { }
+    { mmix-*-* } { }
+    { *c4x*-*-* } { }
+    { *c54x*-*-* } { }
+    { bfin-*-* } { }
+    default {
+       run_dump_test altmacro
+       # The second test is valid only when '!' is not a comment
+       # character (it is allowed to be a line comment character).
+       if [string match "" [lindex [gas_run excl.s "-o /dev/null" ""] 0]] {
+           run_dump_test altmac2
+           # Similarly this test does not work when ! is a line seperator.
+           run_dump_test eval
+       }
     }
 }
 
 # This test is for any COFF target.
-# We omit m88k COFF because it uses weird pseudo-op names.
 # We omit the ARM toolchains because they define locals to
 #  start with '.', which eliminates .eos, .text etc from the output.
 # Omit c54x, since .tag and .def mean something different on that target
-if {   ([istarget *-*-coff*] && ![istarget m88*-*-*] && ![istarget *arm*-*-coff] && ![istarget thumb*-*-coff] && ![istarget *c54x*-*-coff]) \
+if {   ([istarget *-*-coff*] && ![istarget *arm*-*-coff] && ![istarget thumb*-*-coff] && ![istarget xscale-*-coff] && ![istarget *c4x*-*-coff] && ![istarget *c54x*-*-coff]) \
      ||([istarget *-*-pe*] && ![istarget arm*-*-pe*] && ![istarget thumb*-*-pe*]) \
-     || [istarget a29k-*-udi*] \
-     || [istarget a29k-*-ebmon*] \
-     || [istarget a29k-*-sym*] \
-     || [istarget a29k-*-vxworks*] \
      || [istarget i*86-*-aix*] \
      || [istarget i*86-*-sco*] \
      || [istarget i*86-*-isc*] \
      || [istarget i*86-*-go32*] \
      || [istarget i*86-*-cygwin*] \
+     || [istarget x86_64-*-mingw*] \
      || [istarget i*86-*-*nt] \
      || [istarget i*86-*-interix*] \
      || ([istarget i960-*-vxworks5.*] && ![istarget i960-*-vxworks5.0*]) } {
@@ -140,7 +287,7 @@ proc test_cond {} {
        send_log "$comp_output\n"
        fail $testname
     } else {
-       if { [regexp_diff dump.out $srcdir/$subdir/cond.d] } {
+       if { [regexp_diff dump.out $srcdir/$subdir/cond.l] } {
            fail $testname
        } else {
            pass $testname
@@ -148,13 +295,67 @@ proc test_cond {} {
     }
 }
 
+# This test is not suitable for the PA for various reasons
+# not limited to the fact that it depends on specific section
+# names appearing in the output file.
 # again, p2align doesn't work on c54x target
-if ![istarget *c54x*-*-*] then {
-    test_cond
+case $target_triplet in {
+    { hppa*-*-* } { }
+    { *c4x*-*-* } { }
+    { *c54x*-*-* } { }
+    { rx-*-* } { }
+    default {
+        test_cond
+       remote_download host "$srcdir/$subdir/incbin.dat"
+        run_dump_test incbin
+    }
 }
 
-# FIXME: this is here cause of a bug in DejaGnu 1.1.1. When it is no longer
-#        in use, then this can be removed.
-if [info exists errorInfo] then {
-    unset errorInfo
+if {  ([istarget "i*86-*-*pe*"] && ![istarget "i*86-*-openbsd*"]) \
+    || [istarget "i*86-*-cygwin*"] \
+    || [istarget "i*86-*-mingw32*"] } {
+  gas_test "fastcall.s" ""   "" "fastcall labels"
 }
+
+if { ![istarget "bfin-*-*"] } then {
+    run_dump_test assign
+}
+run_dump_test sleb128
+
+# .byte is 32 bits on tic4x, and .p2align isn't supported on tic54x
+# .space is different on hppa*-hpux.
+# MeP put bytes into packets.
+if { ![istarget "tic4x*-*-*"] && ![istarget "tic54x*-*-*"] && ![istarget "hppa*-*-hpux*"] && ![istarget "mep*-*-*"] } {
+    run_dump_test relax
+}
+
+# .quad is 16 bytes on i960.
+if { ![istarget "i960-*-*"] } {
+    run_dump_test quad
+}
+
+
+# .set works differently on some targets.
+case $target_triplet in {
+    { alpha*-*-* } { }
+    { mips*-*-* } { }
+    { *c54x*-*-* } { }
+    { z80-*-* } { }
+    default {
+       run_dump_test weakref1
+       run_dump_test weakref1g
+       run_dump_test weakref1l
+       run_dump_test weakref1u
+       run_dump_test weakref1w
+    }
+}
+gas_test_error "weakref2.s" "" "e: would close weakref loop: e => a => b => c => d => e"
+gas_test_error "weakref3.s" "" "a: would close weakref loop: a => b => c => d => e => a"
+gas_test_error "weakref4.s" "" "is already defined"
+
+run_dump_test string
+
+load_lib gas-dg.exp
+dg-init
+dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/err-*.s $srcdir/$subdir/warn-*.s]] "" ""
+dg-finish
This page took 0.027919 seconds and 4 git commands to generate.