public inbox for binutils-cvs@sourceware.org
 help / color / mirror / Atom feed
* [binutils-gdb] x86: don't allow pseudo-prefixes to be overridden by legacy suffixes
@ 2023-11-17 10:24 Jan Beulich
  0 siblings, 0 replies; only message in thread
From: Jan Beulich @ 2023-11-17 10:24 UTC (permalink / raw)
  To: bfd-cvs

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

commit 97f31cb469f288995d3dcaae406531053dff09fa
Author: Jan Beulich <jbeulich@suse.com>
Date:   Fri Nov 17 11:23:50 2023 +0100

    x86: don't allow pseudo-prefixes to be overridden by legacy suffixes
    
    Deprecated functionality would better not win over its modern
    counterparts.

Diff:
---
 gas/config/tc-i386.c | 22 +++++++++++++++++++---
 1 file changed, 19 insertions(+), 3 deletions(-)

diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c
index 6e788d8ee97..1692dfcdf54 100644
--- a/gas/config/tc-i386.c
+++ b/gas/config/tc-i386.c
@@ -5887,16 +5887,32 @@ parse_insn (const char *line, char *mnemonic, bool prefix_only)
 	 Check if we should swap operand or force 32bit displacement in
 	 encoding.  */
       if (mnem_p - 2 == dot_p && dot_p[1] == 's')
-	i.dir_encoding = dir_encoding_swap;
+	{
+	  if (i.dir_encoding == dir_encoding_default)
+	    i.dir_encoding = dir_encoding_swap;
+	  else
+	    as_warn (_("ignoring `.s' suffix due to earlier `{%s}'"),
+		     i.dir_encoding == dir_encoding_load ? "load" : "store");
+	}
       else if (mnem_p - 3 == dot_p
 	       && dot_p[1] == 'd'
 	       && dot_p[2] == '8')
-	i.disp_encoding = disp_encoding_8bit;
+	{
+	  if (i.disp_encoding == disp_encoding_default)
+	    i.disp_encoding = disp_encoding_8bit;
+	  else if (i.disp_encoding != disp_encoding_8bit)
+	    as_warn (_("ignoring `.d8' suffix due to earlier `{disp<N>}'"));
+	}
       else if (mnem_p - 4 == dot_p
 	       && dot_p[1] == 'd'
 	       && dot_p[2] == '3'
 	       && dot_p[3] == '2')
-	i.disp_encoding = disp_encoding_32bit;
+	{
+	  if (i.disp_encoding == disp_encoding_default)
+	    i.disp_encoding = disp_encoding_32bit;
+	  else if (i.disp_encoding != disp_encoding_32bit)
+	    as_warn (_("ignoring `.d32' suffix due to earlier `{disp<N>}'"));
+	}
       else
 	goto check_suffix;
       mnem_p = dot_p;

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-11-17 10:24 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-17 10:24 [binutils-gdb] x86: don't allow pseudo-prefixes to be overridden by legacy suffixes Jan Beulich

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).