From: Jan Beulich Date: Fri, 1 Dec 2023 07:27:49 +0000 (+0100) Subject: x86: suppress optimization after potential non-insn X-Git-Tag: binutils-2_42~761 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=175ce60f0ff7f3423b49c0d41a88a0c51a08ac03;p=thirdparty%2Fbinutils-gdb.git x86: suppress optimization after potential non-insn Just like avoiding to do other transformations potentially affected by stand-alone prefixes or direct data emission, also avoid optimization on the following insn. --- diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c index 059dd49feea..f2f1e3b9f64 100644 --- 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. */