[2/6] x86: suppress optimization after potential non-insn

Message ID 1cfe196e-4830-49f2-b06c-9c947c4996b5@suse.com
State Unresolved
Headers
Series correct and further utilize x86'es last-insn tracking |

Checks

Context Check Description
snail/binutils-gdb-check warning Git am fail log

Commit Message

Jan Beulich Nov. 24, 2023, 9:03 a.m. UTC
  Just like avoiding to do other transformations potentially affected by
stand-alone prefixes or direct data emission, also avoid optimization
on the following insn.
  

Patch

--- a/gas/config/tc-i386.c
+++ b/gas/config/tc-i386.c
@@ -5120,6 +5120,11 @@  md_assemble (char *line)
  retry:
   init_globals ();
 
+  /* Suppress optimization when the last thing we saw may not have been
+     a proper instruction (e.g. a stand-alone prefix or .byte).  */
+  if (last_insn->kind != last_insn_other)
+    i.no_optimize = true;
+
   /* First parse an instruction mnemonic & call i386_operand for the operands.
      We assume that the scrubber has arranged it so that line[0] is the valid
      start of a (possibly prefixed) mnemonic.  */