public inbox for binutils-cvs@sourceware.org
 help / color / mirror / Atom feed
From: Jan Beulich <jbeulich@sourceware.org>
To: bfd-cvs@sourceware.org
Subject: [binutils-gdb] x86: suppress optimization after potential non-insn
Date: Fri,  1 Dec 2023 07:29:56 +0000 (GMT)	[thread overview]
Message-ID: <20231201072956.8C1AF3857B96@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=175ce60f0ff7f3423b49c0d41a88a0c51a08ac03

commit 175ce60f0ff7f3423b49c0d41a88a0c51a08ac03
Author: Jan Beulich <jbeulich@suse.com>
Date:   Fri Dec 1 08:27:49 2023 +0100

    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:
---
 gas/config/tc-i386.c | 5 +++++
 1 file changed, 5 insertions(+)

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.  */

                 reply	other threads:[~2023-12-01  7:29 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231201072956.8C1AF3857B96@sourceware.org \
    --to=jbeulich@sourceware.org \
    --cc=bfd-cvs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).