aboutsummaryrefslogtreecommitdiff
path: root/gas/testsuite
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2018-02-13 16:50:04 +0000
committerNick Clifton <nickc@redhat.com>2018-02-13 16:50:04 +0000
commitdb7bf1058d28b2b5e931c60435a13f6db15df6af (patch)
tree2ea78fb333faf39121c7d1195b2feaed39b3ddd5 /gas/testsuite
parentbd7ab16b4537788ad53521c45469a1bdae84ad4a (diff)
downloadgdb-db7bf1058d28b2b5e931c60435a13f6db15df6af.zip
gdb-db7bf1058d28b2b5e931c60435a13f6db15df6af.tar.gz
gdb-db7bf1058d28b2b5e931c60435a13f6db15df6af.tar.bz2
Fix ARm assembler so that it rejects invalid immediate values for the Thumb ORR instruction.
PR 22773 * config/tc-arm.c (md_apply_fix): Test Rn field of Thumb ORR instruction before assuming that it is a MOV instruction. * testsuite/gas/arm/pr22773.s: New test. * testsuite/gas/arm/pr22773.d: New test driver. * testsuite/gas/arm/pr22773.l: New expected output.
Diffstat (limited to 'gas/testsuite')
-rw-r--r--gas/testsuite/gas/arm/pr22773.d2
-rw-r--r--gas/testsuite/gas/arm/pr22773.l3
-rw-r--r--gas/testsuite/gas/arm/pr22773.s9
3 files changed, 14 insertions, 0 deletions
diff --git a/gas/testsuite/gas/arm/pr22773.d b/gas/testsuite/gas/arm/pr22773.d
new file mode 100644
index 0000000..adb9681
--- /dev/null
+++ b/gas/testsuite/gas/arm/pr22773.d
@@ -0,0 +1,2 @@
+# name: PR 22773: Invalid immediate constants produce incorrect instruction
+# error-output: pr22773.l
diff --git a/gas/testsuite/gas/arm/pr22773.l b/gas/testsuite/gas/arm/pr22773.l
new file mode 100644
index 0000000..587c8a8
--- /dev/null
+++ b/gas/testsuite/gas/arm/pr22773.l
@@ -0,0 +1,3 @@
+[^:]*: Assembler messages:
+[^:]*:8: Error: invalid constant \(3201\) after fixup
+#pass
diff --git a/gas/testsuite/gas/arm/pr22773.s b/gas/testsuite/gas/arm/pr22773.s
new file mode 100644
index 0000000..011ecfd
--- /dev/null
+++ b/gas/testsuite/gas/arm/pr22773.s
@@ -0,0 +1,9 @@
+ .syntax unified
+ .cpu cortex-m4
+ .thumb
+
+ .section .text
+
+ orr r1, #12800 /* This is OK. */
+ orr r1, #12801 /* This cannot be encoded in Thumb mode. */
+ /* GAS used to accept it though, and produce a MOV instruction instead. */