From: H.J. Lu Date: Sun, 17 Dec 2017 17:40:54 +0000 (-0800) Subject: x86: Check pseudo prefix without instruction X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=390c91cfcffe1a0d75b6100d1542cda2544993b3;p=binutils-gdb.git 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. --- diff --git a/gas/ChangeLog b/gas/ChangeLog index 3e00c761d09..a2d95b740b1 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,12 @@ +2017-12-17 H.J. Lu + + 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 * config/tc-i386.c (match_template): Add missing ! to diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c index 5c71bb69ff6..ae1c523fd7a 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 7e102b621ef..302f91cc60a 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 00000000000..cf344f6986b --- /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 00000000000..a40362b8f95 --- /dev/null +++ b/gas/testsuite/gas/i386/inval-pseudo.s @@ -0,0 +1,5 @@ + .text + nop + {disp32} + nop + .p2align 4,0