aboutsummaryrefslogtreecommitdiff
path: root/gas/read.c
diff options
context:
space:
mode:
authorJan Beulich <jbeulich@suse.com>2023-05-12 08:55:48 +0200
committerJan Beulich <jbeulich@suse.com>2023-05-12 08:55:48 +0200
commitd50c498a1ba7249ccf1d429ce39ab247219c7205 (patch)
treeba7648399a27de94117a511fe5fc8a82ece36e3f /gas/read.c
parent8cea5fda33becb158c51a532e9281a7b17158459 (diff)
downloadgdb-d50c498a1ba7249ccf1d429ce39ab247219c7205.zip
gdb-d50c498a1ba7249ccf1d429ce39ab247219c7205.tar.gz
gdb-d50c498a1ba7249ccf1d429ce39ab247219c7205.tar.bz2
gas: equates of registers
There are two problems: symbol_equated_p() doesn't recognize equates of registers, and S_CAN_BE_REDEFINED() goes by section rather than by expression type. Both together undermine .eqv and .equiv clearly meaning to guard the involved symbols against re-definition (both ways). To compensate pseudo_set() now using O_symbol and S_CAN_BE_REDEFINED() now checking for O_register, - for targets creating register symbols through symbol_{new,create}() -> symbol_init() -> S_SET_VALUE() (alpha, arc, dlx, ia64, m68k, mips, mmix, tic4x, tic54x, plus anything using cgen or itbl-ops), have symbol_init() set their expressions to O_register, - x86'es parse_register() also can't go by section anymore when trying to "look through" equates; probably symbol_equated_p() should have been used there from the beginning, if only that had worked for equates of registers, - various targets need to "look through" equates when parsing insn operands (which also helps transitive forward equates); perhaps even more ought to, but many don't look to consider the possibility of register equates in the first place. This was uncovered by code reported in PR gas/30274 (duplicating PR gas/30272), except that there .eqv was used when really .equ was meant. Therefore that bug report is addressed here only in so far as gas wouldn't crash anymore; the code there still won't assemble successfully, just that now the issues there are properly diagnosed.
Diffstat (limited to 'gas/read.c')
-rw-r--r--gas/read.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/gas/read.c b/gas/read.c
index ac39fc9..b4b628f 100644
--- a/gas/read.c
+++ b/gas/read.c
@@ -4000,6 +4000,10 @@ pseudo_set (symbolS *symbolP)
return;
}
#endif
+ /* Make sure symbol_equated_p() recognizes the symbol as an equate. */
+ exp.X_add_symbol = make_expr_symbol (&exp);
+ exp.X_add_number = 0;
+ exp.X_op = O_symbol;
symbol_set_value_expression (symbolP, &exp);
S_SET_SEGMENT (symbolP, reg_section);
set_zero_frag (symbolP);