aboutsummaryrefslogtreecommitdiff
path: root/gas
diff options
context:
space:
mode:
authorPaul Brook <paul@codesourcery.com>2005-09-06 15:57:06 +0000
committerPaul Brook <paul@codesourcery.com>2005-09-06 15:57:06 +0000
commit9a64e435419869030e27d54f0433810b8b56d1ac (patch)
tree3681699f16aac6d1c4e1f0edc2e05dded5728fbc /gas
parentc0eabf1a036d29726d02f83b54f6b0c7aae4c56d (diff)
downloadgdb-9a64e435419869030e27d54f0433810b8b56d1ac.zip
gdb-9a64e435419869030e27d54f0433810b8b56d1ac.tar.gz
gdb-9a64e435419869030e27d54f0433810b8b56d1ac.tar.bz2
2005-09-02 Paul Brook <paul@codesourcery.com>
gas/ * config/tc-arm.c (do_rn_rd): Enforce SWP operand constraints. gas/testsuite/ * gas/arm/arm3-bad.s: New test. * gas/arm/arm3-bad.d: New test. * gas/arm/arm3.s: Avoid illegal instructions. * gas/arm/arm3.d: Ditto.
Diffstat (limited to 'gas')
-rw-r--r--gas/ChangeLog4
-rw-r--r--gas/config/tc-arm.c7
-rw-r--r--gas/testsuite/ChangeLog7
-rw-r--r--gas/testsuite/gas/arm/arm3-bad.d3
-rw-r--r--gas/testsuite/gas/arm/arm3-bad.l3
-rw-r--r--gas/testsuite/gas/arm/arm3-bad.s7
-rw-r--r--gas/testsuite/gas/arm/arm3.d4
-rw-r--r--gas/testsuite/gas/arm/arm3.s4
8 files changed, 34 insertions, 5 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog
index e50ef06..3745af3 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,5 +1,9 @@
2005-09-02 Paul Brook <paul@codesourcery.com>
+ * config/tc-arm.c (do_rn_rd): Enforce SWP operand constraints.
+
+2005-09-02 Paul Brook <paul@codesourcery.com>
+
* config/tc-arm.c (encode_arm_cp_address): Use
BFD_RELOC_ARM_T32_CP_OFF_IMM in thumb mode.
(do_iwmmxt_wldstbh): Use BFD_RELOC_ARM_T32_CP_OFF_IMM_S2 in thumb
diff --git a/gas/config/tc-arm.c b/gas/config/tc-arm.c
index 16f1db7..23d5bc7 100644
--- a/gas/config/tc-arm.c
+++ b/gas/config/tc-arm.c
@@ -4339,9 +4339,14 @@ do_rn_rd (void)
static void
do_rd_rm_rn (void)
{
+ unsigned Rn = inst.operands[2].reg;
+ /* Enforce resutrictions on SWP instruction. */
+ if ((inst.instruction & 0x0fbfffff) == 0x01000090)
+ constraint (Rn == inst.operands[0].reg || Rn == inst.operands[1].reg,
+ _("Rn must not overlap other operands"));
inst.instruction |= inst.operands[0].reg << 12;
inst.instruction |= inst.operands[1].reg;
- inst.instruction |= inst.operands[2].reg << 16;
+ inst.instruction |= Rn << 16;
}
static void
diff --git a/gas/testsuite/ChangeLog b/gas/testsuite/ChangeLog
index 31b2796..421db35 100644
--- a/gas/testsuite/ChangeLog
+++ b/gas/testsuite/ChangeLog
@@ -1,5 +1,12 @@
2005-09-02 Paul Brook <paul@codesourcery.com>
+ * gas/arm/arm3-bad.s: New test.
+ * gas/arm/arm3-bad.d: New test.
+ * gas/arm/arm3.s: Avoid illegal instructions.
+ * gas/arm/arm3.d: Ditto.
+
+2005-09-02 Paul Brook <paul@codesourcery.com>
+
* gas/arm/vfp-bad_t2.d, gas/arm/vfp-bad_t2.l, arm/vfp-bad_t2.s,
gas/arm/vfp1_t2.d, gas/arm/vfp1_t2.s, gas/arm/vfp1xD_t2.d,
gas/arm/vfp1xD_t2.s, gas/arm/vfp2_t2.d, gas/arm/vfp2_t2.s): New files.
diff --git a/gas/testsuite/gas/arm/arm3-bad.d b/gas/testsuite/gas/arm/arm3-bad.d
new file mode 100644
index 0000000..29449b2
--- /dev/null
+++ b/gas/testsuite/gas/arm/arm3-bad.d
@@ -0,0 +1,3 @@
+# name: ARM 3 errors
+# as: -mcpu=arm3
+# error-output: arm3-bad.l
diff --git a/gas/testsuite/gas/arm/arm3-bad.l b/gas/testsuite/gas/arm/arm3-bad.l
new file mode 100644
index 0000000..d55a9b6
--- /dev/null
+++ b/gas/testsuite/gas/arm/arm3-bad.l
@@ -0,0 +1,3 @@
+.*arm3-bad.s: Assembler messages:
+.*arm3-bad.s:4: Error: Rn must not overlap other operands -- `swp r0,r1,\[r0\]'
+.*arm3-bad.s:5: Error: Rn must not overlap other operands -- `swp r1,r0,\[r0\]'
diff --git a/gas/testsuite/gas/arm/arm3-bad.s b/gas/testsuite/gas/arm/arm3-bad.s
new file mode 100644
index 0000000..d3415a0
--- /dev/null
+++ b/gas/testsuite/gas/arm/arm3-bad.s
@@ -0,0 +1,7 @@
+ .text
+ .align 0
+l:
+ swp r0, r1, [r0]
+ swp r1, r0, [r0]
+ nop
+ nop
diff --git a/gas/testsuite/gas/arm/arm3.d b/gas/testsuite/gas/arm/arm3.d
index 8f1c8a4..06323b1 100644
--- a/gas/testsuite/gas/arm/arm3.d
+++ b/gas/testsuite/gas/arm/arm3.d
@@ -6,6 +6,6 @@
Disassembly of section .text:
0+0 <[^>]*> e1080091 ? swp r0, r1, \[r8\]
-0+4 <[^>]*> e1432093 ? swpb r2, r3, \[r3\]
-0+8 <[^>]*> a1444091 ? swpgeb r4, r1, \[r4\]
+0+4 <[^>]*> e1423093 ? swpb r3, r3, \[r2\]
+0+8 <[^>]*> a1454091 ? swpgeb r4, r1, \[r5\]
0+c <[^>]*> e1a00000 ? nop \(mov r0,r0\)
diff --git a/gas/testsuite/gas/arm/arm3.s b/gas/testsuite/gas/arm/arm3.s
index 8de03b9..b3fd794 100644
--- a/gas/testsuite/gas/arm/arm3.s
+++ b/gas/testsuite/gas/arm/arm3.s
@@ -2,6 +2,6 @@
.align 0
l:
swp r0, r1, [r8]
- swpb r2, r3, [r3]
- swpgeb r4, r1, [r4]
+ swpb r3, r3, [r2]
+ swpgeb r4, r1, [r5]
nop