aboutsummaryrefslogtreecommitdiff
path: root/gas
diff options
context:
space:
mode:
authorJan Beulich <jbeulich@suse.com>2021-05-07 12:02:40 +0200
committerJan Beulich <jbeulich@suse.com>2021-05-07 12:02:40 +0200
commit9aac24b1a8382f257c4ea223ebefd5e397dfe59b (patch)
tree01e8999d011e26681589d58b968208fdce1af02e /gas
parent87ed972dc348404a4f8b820efa8dc79aaaa966f2 (diff)
downloadgdb-9aac24b1a8382f257c4ea223ebefd5e397dfe59b.zip
gdb-9aac24b1a8382f257c4ea223ebefd5e397dfe59b.tar.gz
gdb-9aac24b1a8382f257c4ea223ebefd5e397dfe59b.tar.bz2
x86: move register check in immediate operand parsing
i386_finalize_immediate() is used for both AT&T and Intel immediate operand handling. Move an AT&T-only check to i386_immediate(), which at the same time allows it to cover other cases as well, giving an overall better / more consistent diagnostic.
Diffstat (limited to 'gas')
-rw-r--r--gas/ChangeLog6
-rw-r--r--gas/config/tc-i386.c14
2 files changed, 13 insertions, 7 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog
index ad82f9b..ba307b8 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,5 +1,11 @@
2021-05-07 Jan Beulich <jbeulich@suse.com>
+ * config/tc-i386.c (i386_finalize_immediate): Move register
+ check ...
+ (i386_immediate): ... here.
+
+2021-05-07 Jan Beulich <jbeulich@suse.com>
+
* config/tc-i386.c (optimize_imm): Drop redundant masking.
Re-arrange operand type accumulation.
diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c
index c09d63f..7e1d155 100644
--- a/gas/config/tc-i386.c
+++ b/gas/config/tc-i386.c
@@ -10690,10 +10690,16 @@ i386_immediate (char *imm_start)
{
free (gotfree_input_line);
- if (exp->X_op == O_constant || exp->X_op == O_register)
+ if (exp->X_op == O_constant)
exp->X_op = O_illegal;
}
+ if (exp_seg == reg_section)
+ {
+ as_bad (_("illegal immediate register operand %s"), imm_start);
+ return 0;
+ }
+
return i386_finalize_immediate (exp_seg, exp, types, imm_start);
}
@@ -10731,12 +10737,6 @@ i386_finalize_immediate (segT exp_seg ATTRIBUTE_UNUSED, expressionS *exp,
return 0;
}
#endif
- else if (!intel_syntax && exp_seg == reg_section)
- {
- if (imm_start)
- as_bad (_("illegal immediate register operand %s"), imm_start);
- return 0;
- }
else
{
/* This is an address. The size of the address will be