aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2017-12-17 09:40:54 -0800
committerH.J. Lu <hjl.tools@gmail.com>2017-12-17 09:49:11 -0800
commit390c91cfcffe1a0d75b6100d1542cda2544993b3 (patch)
treed8ec475bc43d85d12726ba994953b79aa0097155
parentfd7055f4a7f8eef9dc926fae698ad297279726bb (diff)
downloadgdb-390c91cfcffe1a0d75b6100d1542cda2544993b3.zip
gdb-390c91cfcffe1a0d75b6100d1542cda2544993b3.tar.gz
gdb-390c91cfcffe1a0d75b6100d1542cda2544993b3.tar.bz2
x86: Check pseudo prefix without instruction
Pseudo prefixes must be used on an instruction. Issue an error when pseudo prefix is used without instruction. PR gas/22623 * gas/config/tc-i386.c (output_insn): Check pseudo prefix without instruction. * testsuite/gas/i386/i386.exp: Run inval-pseudo. * testsuite/gas/i386/inval-pseudo.l: New file. * testsuite/gas/i386/inval-pseudo.s: Likewise.
-rw-r--r--gas/ChangeLog9
-rw-r--r--gas/config/tc-i386.c6
-rw-r--r--gas/testsuite/gas/i386/i386.exp1
-rw-r--r--gas/testsuite/gas/i386/inval-pseudo.l11
-rw-r--r--gas/testsuite/gas/i386/inval-pseudo.s5
5 files changed, 32 insertions, 0 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog
index 3e00c76..a2d95b7 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,3 +1,12 @@
+2017-12-17 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR gas/22623
+ * gas/config/tc-i386.c (output_insn): Check pseudo prefix
+ without instruction.
+ * testsuite/gas/i386/i386.exp: Run inval-pseudo.
+ * testsuite/gas/i386/inval-pseudo.l: New file.
+ * testsuite/gas/i386/inval-pseudo.s: Likewise.
+
2017-12-15 Jan Beulich <jbeulich@suse.com>
* config/tc-i386.c (match_template): Add missing ! to
diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c
index 5c71bb6..ae1c523 100644
--- a/gas/config/tc-i386.c
+++ b/gas/config/tc-i386.c
@@ -7258,6 +7258,12 @@ check_prefix:
break;
case 1:
break;
+ case 0:
+ /* Check for pseudo prefixes. */
+ as_bad_where (insn_start_frag->fr_file,
+ insn_start_frag->fr_line,
+ _("pseudo prefix without instruction"));
+ return;
default:
abort ();
}
diff --git a/gas/testsuite/gas/i386/i386.exp b/gas/testsuite/gas/i386/i386.exp
index 7e102b6..302f91c 100644
--- a/gas/testsuite/gas/i386/i386.exp
+++ b/gas/testsuite/gas/i386/i386.exp
@@ -429,6 +429,7 @@ if [expr ([istarget "i*86-*-*"] || [istarget "x86_64-*-*"]) && [gas_32_check]]
run_list_test "notrackbad" "-al"
run_dump_test "align-1a"
run_dump_test "align-1b"
+ run_list_test "inval-pseudo" "-al"
# These tests require support for 8 and 16 bit relocs,
# so we only run them for ELF and COFF targets.
diff --git a/gas/testsuite/gas/i386/inval-pseudo.l b/gas/testsuite/gas/i386/inval-pseudo.l
new file mode 100644
index 0000000..cf344f6
--- /dev/null
+++ b/gas/testsuite/gas/i386/inval-pseudo.l
@@ -0,0 +1,11 @@
+.*: Assembler messages:
+.*:3: Error: .*
+GAS LISTING .*
+
+
+[ ]*1[ ]+\.text
+[ ]*2[ ]+\?\?\?\? 90 nop
+[ ]*3[ ]+\{disp32\}
+[ ]*4[ ]+\?\?\?\? 90 nop
+[ ]*5[ ]+\?\?\?\? 00000000 \.p2align 4,0
+#...
diff --git a/gas/testsuite/gas/i386/inval-pseudo.s b/gas/testsuite/gas/i386/inval-pseudo.s
new file mode 100644
index 0000000..a40362b
--- /dev/null
+++ b/gas/testsuite/gas/i386/inval-pseudo.s
@@ -0,0 +1,5 @@
+ .text
+ nop
+ {disp32}
+ nop
+ .p2align 4,0