diff options
author | Jan Beulich <jbeulich@novell.com> | 2018-07-31 10:54:05 +0200 |
---|---|---|
committer | Jan Beulich <jbeulich@suse.com> | 2018-07-31 10:54:05 +0200 |
commit | 7a8655d2bbdc788786cb28e925e1d4303cd960b0 (patch) | |
tree | 60208a5f8726cd091cc3b5e1816dc74c7c2ca70b /gas/config | |
parent | e951d5ca3d73cfd71a002b91c16d6036240213e6 (diff) | |
download | gdb-7a8655d2bbdc788786cb28e925e1d4303cd960b0.zip gdb-7a8655d2bbdc788786cb28e925e1d4303cd960b0.tar.gz gdb-7a8655d2bbdc788786cb28e925e1d4303cd960b0.tar.bz2 |
x86: don't abort() upon DATA16 prefix on (E)VEX encoded insn
Instead of hitting the abort() in output_insn() (commented by "There
should be no other prefixes for instructions with VEX prefix"), report
a proper diagnostic instead, just like we do e.g. for invalid REP
prefixes.
Diffstat (limited to 'gas/config')
-rw-r--r-- | gas/config/tc-i386.c | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c index 5a5bf5f..438bae9 100644 --- a/gas/config/tc-i386.c +++ b/gas/config/tc-i386.c @@ -3478,6 +3478,13 @@ is_evex_encoding (const insn_template *t) || t->opcode_modifier.staticrounding || t->opcode_modifier.sae; } +static INLINE bfd_boolean +is_any_vex_encoding (const insn_template *t) +{ + return t->opcode_modifier.vex || t->opcode_modifier.vexopcode + || is_evex_encoding (t); +} + /* Build the EVEX prefix. */ static void @@ -3760,9 +3767,7 @@ bad_register_operand: gas_assert (i.imm_operands <= 1 && (i.operands <= 2 - || ((i.tm.opcode_modifier.vex - || i.tm.opcode_modifier.vexopcode - || is_evex_encoding (&i.tm)) + || (is_any_vex_encoding (&i.tm) && i.operands <= 4))); exp = &im_expressions[i.imm_operands++]; @@ -4125,6 +4130,13 @@ md_assemble (char *line) return; } + /* Check for data size prefix on VEX/XOP/EVEX encoded insns. */ + if (i.prefix[DATA_PREFIX] && is_any_vex_encoding (&i.tm)) + { + as_bad (_("data size prefix invalid with `%s'"), i.tm.name); + return; + } + /* Check if HLE prefix is OK. */ if (i.hle_prefix && !check_hle ()) return; @@ -4211,8 +4223,7 @@ md_assemble (char *line) as_warn (_("translating to `%sp'"), i.tm.name); } - if (i.tm.opcode_modifier.vex || i.tm.opcode_modifier.vexopcode - || is_evex_encoding (&i.tm)) + if (is_any_vex_encoding (&i.tm)) { if (flag_code == CODE_16BIT) { @@ -6137,6 +6148,9 @@ process_suffix (void) else if (i.suffix != QWORD_MNEM_SUFFIX && !i.tm.opcode_modifier.ignoresize && !i.tm.opcode_modifier.floatmf + && !i.tm.opcode_modifier.vex + && !i.tm.opcode_modifier.vexopcode + && !is_evex_encoding (&i.tm) && ((i.suffix == LONG_MNEM_SUFFIX) == (flag_code == CODE_16BIT) || (flag_code == CODE_64BIT && i.tm.opcode_modifier.jumpbyte))) |