gas: apply md_register_arithmetic also to unary '+'

Even a unary '+' has to be considered arithmetic; at least on x86 in
Intel Syntax mode otherwise bogus insn operands may be accepted.
Convert this specific case to binary + (i.e. 0 + <register>). (An
implication is that md_operator(,1,) would need to deal with arch-
specific equivalents of unary '+' is a similar way, if such an arch-
specific variant would be specified in the first place.)

To avoid duplicating what make_expr_symbol() does to construct a
constant-zero expression, simply make its previously local variable a
file-scope static one. This way there's also no need to invoke
clean_up_expression().
This commit is contained in:
Jan Beulich
2023-03-17 10:07:05 +01:00
parent 1250cd6390
commit 529b6c24ff
2 changed files with 16 additions and 11 deletions

View File

@@ -182,7 +182,7 @@ extern void add_to_result (expressionS *, offsetT, int);
extern void subtract_from_result (expressionS *, offsetT, int);
extern segT expr (int, expressionS *, enum expr_mode);
extern unsigned int get_single_number (void);
extern symbolS *make_expr_symbol (expressionS * expressionP);
extern symbolS *make_expr_symbol (const expressionS * expressionP);
extern int expr_symbol_where (symbolS *, const char **, unsigned int *);
extern void current_location (expressionS *);
extern symbolS *expr_build_uconstant (offsetT);