aboutsummaryrefslogtreecommitdiff
path: root/gas/config/tc-i386.c
diff options
context:
space:
mode:
authorJan Beulich <jbeulich@suse.com>2024-07-19 11:52:21 +0200
committerJan Beulich <jbeulich@suse.com>2024-07-19 11:52:21 +0200
commit3fea91b17da717d19e73f073501307d2f0bbeb2b (patch)
tree446975de10fc3c478733c9246fffbd40a6ccbd72 /gas/config/tc-i386.c
parent0ff4e567db6c3c9da83073fe6abe27f561a2475b (diff)
downloadbinutils-3fea91b17da717d19e73f073501307d2f0bbeb2b.zip
binutils-3fea91b17da717d19e73f073501307d2f0bbeb2b.tar.gz
binutils-3fea91b17da717d19e73f073501307d2f0bbeb2b.tar.bz2
x86: accept whitespace inside curly braces
Other than documented /**/ comments currently aren't really converted to a single space, at least not for x86 in its most common configurations. That'll be fixed subsequently, at which point blanks may appear where so far none were expected. Furthermore not permitting blanks immediately inside curly braces wasn't quite logical anyway - such constructs are composite ones, and hence components ought to have been permitted to be separated by whitespace from the very beginning. With this we also don't care anymore whether the scrubber would remove whitespace around curly braces, so move them from extra_symbol_chars[] to operand_special_chars[]. Note: The new testcase doesn't actually exercise much (if any) of the added code. It is being put in place to ensure that subsequently, when that code actually comes into play, behavior remains the same.
Diffstat (limited to 'gas/config/tc-i386.c')
-rw-r--r--gas/config/tc-i386.c23
1 files changed, 18 insertions, 5 deletions
diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c
index bbc8618..f7be075 100644
--- a/gas/config/tc-i386.c
+++ b/gas/config/tc-i386.c
@@ -526,7 +526,7 @@ static const unsigned char i386_seg_prefixes[] = {
/* List of chars besides those in app.c:symbol_chars that can start an
operand. Used to prevent the scrubber eating vital white-space. */
-const char extra_symbol_chars[] = "*%-([{}"
+const char extra_symbol_chars[] = "*%-(["
#ifdef LEX_AT
"@"
#endif
@@ -587,7 +587,7 @@ static char operand_chars[256];
/* All non-digit non-letter characters that may occur in an operand and
which aren't already in extra_symbol_chars[]. */
-static const char operand_special_chars[] = "$+,)._~/<>|&^!=:@]";
+static const char operand_special_chars[] = "$+,)._~/<>|&^!=:@]{}";
/* md_assemble() always leaves the strings it's passed unaltered. To
effect this we maintain a stack of saved characters that we've smashed
@@ -7856,6 +7856,8 @@ parse_insn (const char *line, char *mnemonic, enum parse_mode mode)
{
++mnem_p;
++l;
+ if (is_space_char (*l))
+ ++l;
}
else if (mode == parse_pseudo_prefix)
break;
@@ -7873,6 +7875,8 @@ parse_insn (const char *line, char *mnemonic, enum parse_mode mode)
l++;
}
/* Pseudo-prefixes end with a closing figure brace. */
+ if (*mnemonic == '{' && is_space_char (*l))
+ ++l;
if (*mnemonic == '{' && *l == '}')
{
*mnem_p++ = *l++;
@@ -14468,6 +14472,8 @@ check_VecOperations (char *op_string)
if (*op_string == '{')
{
op_string++;
+ if (is_space_char (*op_string))
+ op_string++;
/* Check broadcasts. */
if (startswith (op_string, "1to"))
@@ -14638,6 +14644,8 @@ check_VecOperations (char *op_string)
else
goto unknown_vec_op;
+ if (is_space_char (*op_string))
+ op_string++;
if (*op_string != '}')
{
as_bad (_("missing `}' in `%s'"), saved);
@@ -14645,8 +14653,6 @@ check_VecOperations (char *op_string)
}
op_string++;
- /* Strip whitespace since the addition of pseudo prefixes
- changed how the scrubber treats '{'. */
if (is_space_char (*op_string))
++op_string;
@@ -15308,10 +15314,17 @@ RC_SAE_immediate (const char *imm_start)
if (*pstr != '{')
return 0;
- pstr = RC_SAE_specifier (pstr + 1);
+ pstr++;
+ if (is_space_char (*pstr))
+ pstr++;
+
+ pstr = RC_SAE_specifier (pstr);
if (pstr == NULL)
return 0;
+ if (is_space_char (*pstr))
+ pstr++;
+
if (*pstr++ != '}')
{
as_bad (_("Missing '}': '%s'"), imm_start);