diff options
author | Dmitry Selyutin <ghostmansd@gmail.com> | 2022-07-18 12:46:53 +0300 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2022-07-20 12:20:14 +0930 |
commit | ffd29c9c21422ddacdd66ead68ee060ac01a28c5 (patch) | |
tree | 8a11642e5cd5e8dce66bd2ab172105d65cf7c28f /gas | |
parent | 73d9afb778a2278c9a6fcc17f9a2c2ccbef8cce5 (diff) | |
download | gdb-ffd29c9c21422ddacdd66ead68ee060ac01a28c5.zip gdb-ffd29c9c21422ddacdd66ead68ee060ac01a28c5.tar.gz gdb-ffd29c9c21422ddacdd66ead68ee060ac01a28c5.tar.bz2 |
gas/symbols: introduce md_resolve_symbol
Assuming GMSD is a special operand, marked as O_md1, the code:
.set VREG, GMSD
.set REG, VREG
extsw REG, 2
...fails upon attempts to resolve the value of the symbol. This happens
since machine-dependent values are not handled in the giant op switch.
We introduce a custom md_resolve_symbol macro; the ports can use this
macro to customize the behavior when resolve_symbol_value hits O_md
operand.
Diffstat (limited to 'gas')
-rw-r--r-- | gas/doc/internals.texi | 6 | ||||
-rw-r--r-- | gas/symbols.c | 39 |
2 files changed, 45 insertions, 0 deletions
diff --git a/gas/doc/internals.texi b/gas/doc/internals.texi index 9221801..59b2d3a 100644 --- a/gas/doc/internals.texi +++ b/gas/doc/internals.texi @@ -1034,6 +1034,12 @@ Predefined symbols with fixed values, such as register names or condition codes, are typically entered directly into the symbol table when @code{md_begin} is called. One argument is passed, a @code{char *} for the symbol. +@item md_resolve_symbol +@cindex md_resolve_symbol +If this macro is defined, GAS will call it upon resolving machine-dependent +symbols (that is, for any symbol with operation O_md1..O_md32 inclusively). +If this functions returns zero, then the symbol could not be resolved. + @item md_operand @cindex md_operand GAS will call this function with one argument, an @code{expressionS} diff --git a/gas/symbols.c b/gas/symbols.c index 6904a31..81383a5 100644 --- a/gas/symbols.c +++ b/gas/symbols.c @@ -1408,6 +1408,45 @@ resolve_symbol_value (symbolS *symp) BAD_CASE (op); break; + case O_md1: + case O_md2: + case O_md3: + case O_md4: + case O_md5: + case O_md6: + case O_md7: + case O_md8: + case O_md9: + case O_md10: + case O_md11: + case O_md12: + case O_md13: + case O_md14: + case O_md15: + case O_md16: + case O_md17: + case O_md18: + case O_md19: + case O_md20: + case O_md21: + case O_md22: + case O_md23: + case O_md24: + case O_md25: + case O_md26: + case O_md27: + case O_md28: + case O_md29: + case O_md30: + case O_md31: + case O_md32: +#ifdef md_resolve_symbol + resolved = md_resolve_symbol (symp, &final_val, &final_seg); + if (resolved) + break; +#endif + goto exit_dont_set_value; + case O_absent: final_val = 0; /* Fall through. */ |