[4/8] x86: correct absolute branch check with segment override

Message ID a4217b6a-f45a-fb2c-d78f-d10b6d3e304d@suse.com
State New
Headers show
Series
  • x86: some tidying and quoted symbols fixes
Related show

Commit Message

Alan Modra via Binutils June 4, 2021, 1:40 p.m.
This needs to happen before checking of what may legitimately start a
memory operand (like is done when there's no segment override). Plus a
second '*' shouldn't be permitted when one was already found before the
segment override.

gas/
2021-06-XX  Jan Beulich  <jbeulich@suse.com>

	* config/tc-i386.c (i386_att_operand): Flip checking for '*' and
	start-of-expression. Don't permit '*' when one was already seen.

Patch

--- a/gas/config/tc-i386.c
+++ b/gas/config/tc-i386.c
@@ -11413,22 +11413,22 @@  i386_att_operand (char *operand_string)
 	  if (is_space_char (*op_string))
 	    ++op_string;
 
-	  if (!is_digit_char (*op_string)
-	      && !is_identifier_char (*op_string)
-	      && *op_string != '('
-	      && *op_string != ABSOLUTE_PREFIX)
-	    {
-	      as_bad (_("bad memory operand `%s'"), op_string);
-	      return 0;
-	    }
 	  /* Handle case of %es:*foo.  */
-	  if (*op_string == ABSOLUTE_PREFIX)
+	  if (!i.jumpabsolute && *op_string == ABSOLUTE_PREFIX)
 	    {
 	      ++op_string;
 	      if (is_space_char (*op_string))
 		++op_string;
 	      i.jumpabsolute = true;
 	    }
+
+	  if (!is_digit_char (*op_string)
+	      && !is_identifier_char (*op_string)
+	      && *op_string != '(')
+	    {
+	      as_bad (_("bad memory operand `%s'"), op_string);
+	      return 0;
+	    }
 	  goto do_memory_reference;
 	}