aboutsummaryrefslogtreecommitdiff
path: root/gas/testsuite
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2005-10-11 11:16:17 +0000
committerNick Clifton <nickc@redhat.com>2005-10-11 11:16:17 +0000
commit9497f5ac6bc10bdd65ea471787619bde1edca77d (patch)
tree7f36b3cb6f0d84b058dfba51242bd900edde9503 /gas/testsuite
parent1334d4d50c52bc295dace4982442369838f478b3 (diff)
downloadgdb-9497f5ac6bc10bdd65ea471787619bde1edca77d.zip
gdb-9497f5ac6bc10bdd65ea471787619bde1edca77d.tar.gz
gdb-9497f5ac6bc10bdd65ea471787619bde1edca77d.tar.bz2
This adjusts equate handling by
- allowing true forward references (which will always assume the referenced symbols have at the point of use) through the new .eqv pseudo-op and the new == operator - disallowing changing .equiv-generated equates (so that the protection this provides is both forward and backward) - snapshotting equates when their value gets changed so that previous uses don't get affected by the new value. - allowing expressions in places where absolute expressions (or register names) are needed which were not completely resolvable at the point of their definition but which are fully resolvable at the point of use In addition it fixes PR/288.
Diffstat (limited to 'gas/testsuite')
-rw-r--r--gas/testsuite/ChangeLog19
-rw-r--r--gas/testsuite/gas/all/assign-bad.s2
-rw-r--r--gas/testsuite/gas/all/assign-ok.s3
-rw-r--r--gas/testsuite/gas/all/cond.l (renamed from gas/testsuite/gas/all/cond.d)6
-rw-r--r--gas/testsuite/gas/all/cond.s8
-rw-r--r--gas/testsuite/gas/all/equ-bad.s2
-rw-r--r--gas/testsuite/gas/all/equ-ok.s2
-rw-r--r--gas/testsuite/gas/all/equiv1.s5
-rw-r--r--gas/testsuite/gas/all/equiv2.s6
-rw-r--r--gas/testsuite/gas/all/eqv-bad.s2
-rw-r--r--gas/testsuite/gas/all/eqv-ok.s1
-rw-r--r--gas/testsuite/gas/all/eval.d8
-rw-r--r--gas/testsuite/gas/all/eval.s48
-rw-r--r--gas/testsuite/gas/all/forward.d8
-rw-r--r--gas/testsuite/gas/all/forward.s44
-rw-r--r--gas/testsuite/gas/all/gas.exp54
-rw-r--r--gas/testsuite/gas/all/redef.d8
-rw-r--r--gas/testsuite/gas/all/redef.s11
18 files changed, 236 insertions, 1 deletions
diff --git a/gas/testsuite/ChangeLog b/gas/testsuite/ChangeLog
index ab3ce31..5ed3d10 100644
--- a/gas/testsuite/ChangeLog
+++ b/gas/testsuite/ChangeLog
@@ -1,3 +1,22 @@
+2005-10-11 Jan Beulich <jbeulich@novell.com>
+
+ * gas/all/cond.s: Add test for resolution of fully resolvable
+ forward references in .if/.endif.
+ * gas/all/cond.d: Rename to:
+ * gas/all/cond.l: New.
+ * gas/all/assign-bad.s: New.
+ * gas/all/assign-ok.s: New.
+ * gas/all/equ-bad.s: New.
+ * gas/all/equ-ok.s: New.
+ * gas/all/equiv1.s: New.
+ * gas/all/equiv2.s: New.
+ * gas/all/eqv-bad.s: New.
+ * gas/all/eqv-ok.s: New.
+ * gas/all/eval.[sd]: New.
+ * gas/all/forward.[sd]: New.
+ * gas/all/redef.[sd]: New.
+ * gas/all/gas.exp: Run new tests, but xfail equiv1 (PR/1387).
+
2005-10-10 Nick Clifton <nickc@redhat.com>
* gas/sh/reg-prefix.s: Use mov.l instruction in preference to
diff --git a/gas/testsuite/gas/all/assign-bad.s b/gas/testsuite/gas/all/assign-bad.s
new file mode 100644
index 0000000..3c7a2d7
--- /dev/null
+++ b/gas/testsuite/gas/all/assign-bad.s
@@ -0,0 +1,2 @@
+ yyy == 3
+ yyy == 4
diff --git a/gas/testsuite/gas/all/assign-ok.s b/gas/testsuite/gas/all/assign-ok.s
new file mode 100644
index 0000000..fb8e06f
--- /dev/null
+++ b/gas/testsuite/gas/all/assign-ok.s
@@ -0,0 +1,3 @@
+ xxx = 1
+ xxx = 2
+ yyy == 3
diff --git a/gas/testsuite/gas/all/cond.d b/gas/testsuite/gas/all/cond.l
index e13ac90..a103d8d 100644
--- a/gas/testsuite/gas/all/cond.d
+++ b/gas/testsuite/gas/all/cond.l
@@ -24,6 +24,12 @@
29[ ]+.else
31[ ]+.endif
[ ]*[1-9][0-9]*[ ]+
+[ ]*[1-9][0-9]*[ ]+\.equiv[ ]+x,[ ]*y[ ]*
+[ ]*[1-9][0-9]*[ ]+\.equiv[ ]+y,[ ]*0[ ]*
+[ ]*[1-9][0-9]*[ ]+\.if[ ]+x[ ]*
+[ ]*[1-9][0-9]*[ ]+\.elseif[ ]+x[ ]*
+[ ]*[1-9][0-9]*[ ]+\.endif[ ]*
+[ ]*[1-9][0-9]*[ ]+
[ ]*[1-9][0-9]*[ ]+\.macro[ ]+m[ ]+x,[ ]*y[ ]*
#...
[ ]*[1-9][0-9]*[ ]+\.endm[ ]*
diff --git a/gas/testsuite/gas/all/cond.s b/gas/testsuite/gas/all/cond.s
index b8136ba..2737d1f 100644
--- a/gas/testsuite/gas/all/cond.s
+++ b/gas/testsuite/gas/all/cond.s
@@ -30,6 +30,14 @@
.long 9
.endif
+ .equiv x, y
+ .equiv y, 0
+ .if x
+ .err
+ .elseif x
+ .err
+ .endif
+
.macro m x, y
.ifb \x
.long -1
diff --git a/gas/testsuite/gas/all/equ-bad.s b/gas/testsuite/gas/all/equ-bad.s
new file mode 100644
index 0000000..4e3f931
--- /dev/null
+++ b/gas/testsuite/gas/all/equ-bad.s
@@ -0,0 +1,2 @@
+ .equ x, 1
+ .eqv x, 2
diff --git a/gas/testsuite/gas/all/equ-ok.s b/gas/testsuite/gas/all/equ-ok.s
new file mode 100644
index 0000000..c620e97
--- /dev/null
+++ b/gas/testsuite/gas/all/equ-ok.s
@@ -0,0 +1,2 @@
+ .equ x, 1
+ .equ x, 2
diff --git a/gas/testsuite/gas/all/equiv1.s b/gas/testsuite/gas/all/equiv1.s
new file mode 100644
index 0000000..cd59bda
--- /dev/null
+++ b/gas/testsuite/gas/all/equiv1.s
@@ -0,0 +1,5 @@
+;# Re-definition of an already .equiv-ed symbol (to another symbol).
+;# The assembler should reject this.
+ .equiv x, y
+ .equiv y, 1
+ .equiv x, 0
diff --git a/gas/testsuite/gas/all/equiv2.s b/gas/testsuite/gas/all/equiv2.s
new file mode 100644
index 0000000..c533af7
--- /dev/null
+++ b/gas/testsuite/gas/all/equiv2.s
@@ -0,0 +1,6 @@
+;# Re-definition of an already .equiv-ed symbol (to an expression).
+;# The assembler should reject this.
+ .equiv x, y-z
+ .equiv y, 1
+ .equiv z, 1
+ .equiv x, 1
diff --git a/gas/testsuite/gas/all/eqv-bad.s b/gas/testsuite/gas/all/eqv-bad.s
new file mode 100644
index 0000000..66172b3
--- /dev/null
+++ b/gas/testsuite/gas/all/eqv-bad.s
@@ -0,0 +1,2 @@
+ .eqv x, 1
+ .eqv x, 2
diff --git a/gas/testsuite/gas/all/eqv-ok.s b/gas/testsuite/gas/all/eqv-ok.s
new file mode 100644
index 0000000..2fe13d5
--- /dev/null
+++ b/gas/testsuite/gas/all/eqv-ok.s
@@ -0,0 +1 @@
+ .eqv x, 1
diff --git a/gas/testsuite/gas/all/eval.d b/gas/testsuite/gas/all/eval.d
new file mode 100644
index 0000000..9a7e9e8
--- /dev/null
+++ b/gas/testsuite/gas/all/eval.d
@@ -0,0 +1,8 @@
+#objdump: -s -j .data
+#name: evaluation of simple expressions
+
+.*: .*
+
+Contents of section .data:
+ 0000 01010101 010101.. ........ ........ ................
+#pass
diff --git a/gas/testsuite/gas/all/eval.s b/gas/testsuite/gas/all/eval.s
new file mode 100644
index 0000000..14efe94
--- /dev/null
+++ b/gas/testsuite/gas/all/eval.s
@@ -0,0 +1,48 @@
+.equ zero, 0
+.equ one, 1
+.equ two, 2
+
+
+ .data
+
+ .if two > one
+ .byte one
+ .else
+ .byte two
+ .endif
+
+ .if one == one
+ .byte one
+ .else
+ .byte two
+ .endif
+
+ .if one < two
+ .byte one
+ .else
+ .byte two
+ .endif
+
+ .if one <> two
+ .byte one
+ .else
+ .byte two
+ .endif
+
+ .if one != two
+ .byte one
+ .else
+ .byte two
+ .endif
+
+ .if one <= two
+ .byte one
+ .else
+ .byte two
+ .endif
+
+ .if two >= one
+ .byte one
+ .else
+ .byte two
+ .endif
diff --git a/gas/testsuite/gas/all/forward.d b/gas/testsuite/gas/all/forward.d
new file mode 100644
index 0000000..8e45201
--- /dev/null
+++ b/gas/testsuite/gas/all/forward.d
@@ -0,0 +1,8 @@
+#objdump: -s -j .data
+#name: forward references
+
+.*: .*
+
+Contents of section .data:
+ 0000 01020304 ff0203fc 01020304 ff0203fc ................
+#pass
diff --git a/gas/testsuite/gas/all/forward.s b/gas/testsuite/gas/all/forward.s
new file mode 100644
index 0000000..d51103c
--- /dev/null
+++ b/gas/testsuite/gas/all/forward.s
@@ -0,0 +1,44 @@
+ .equiv two, 2*one
+ .equiv minus_one, -one
+ .equ one, 1
+ .equiv three, 3*one
+ .eqv four, 4*one
+
+ .data
+
+ .if two > one
+ .byte one
+ .byte two
+ .endif
+
+ .if four > one
+ .byte three
+ .byte four
+ .endif
+
+ .equ one, -1
+ .byte one
+ .byte two
+
+ .if four < one
+ .byte three
+ .byte four
+ .endif
+
+ .equ one, -minus_one
+ .byte one
+ .byte two
+
+ .if four > one
+ .byte three
+ .byte four
+ .endif
+
+ .equ one, minus_one
+ .byte one
+ .byte two
+
+ .if four < one
+ .byte three
+ .byte four
+ .endif
diff --git a/gas/testsuite/gas/all/gas.exp b/gas/testsuite/gas/all/gas.exp
index 2a9aeb7..a5a8f4b 100644
--- a/gas/testsuite/gas/all/gas.exp
+++ b/gas/testsuite/gas/all/gas.exp
@@ -34,6 +34,56 @@ if ![istarget hppa*-*-*] then {
gas_test_error "diff1.s" "" "difference of two undefined symbols"
}
+# PR/1387
+setup_xfail "*-*-*"
+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"
+
+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 {
+ { crx*-*-* } { }
+ { h8300*-*-* } { }
+ { hppa*-*-* } { }
+ { mn10\[23\]00*-*-* } { }
+ { *c54x*-*-* } { }
+ 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.
+case $target_triplet in {
+ { alpha*-*-* } { }
+ { iq2000*-*-* } { }
+ { mips*-*-* } { }
+ { *c54x*-*-* } { }
+ default {
+ setup_xfail "*c30*-*-*" "*c4x*-*-*" "pdp11-*-*"
+ run_dump_test redef
+ }
+}
+
proc do_comment {} {
set testname "comment.s: comments in listings"
set x1 0
@@ -129,6 +179,8 @@ case $target_triplet in {
# 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
}
}
}
@@ -162,7 +214,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
diff --git a/gas/testsuite/gas/all/redef.d b/gas/testsuite/gas/all/redef.d
new file mode 100644
index 0000000..fed1998
--- /dev/null
+++ b/gas/testsuite/gas/all/redef.d
@@ -0,0 +1,8 @@
+#objdump: -s -j .data
+#name: .equ redefinitions
+
+.*: .*
+
+Contents of section .data:
+ 0000 00000000 0[04]00000[04] 0[08]00000[08] 0[0c]00000[0c][ ]+................[ ]*
+#pass
diff --git a/gas/testsuite/gas/all/redef.s b/gas/testsuite/gas/all/redef.s
new file mode 100644
index 0000000..896c460
--- /dev/null
+++ b/gas/testsuite/gas/all/redef.s
@@ -0,0 +1,11 @@
+ .data
+_start:
+ .set x, .-_start
+ .long x
+ .balign 4
+ .set x, .-_start
+ .long x
+ .set x, .-_start
+ .long x
+ .set x, .-_start
+ .long x