public inbox for binutils-cvs@sourceware.org
help / color / mirror / Atom feed
* [binutils-gdb] gas/symbols: introduce md_resolve_symbol
@ 2022-07-20 3:06 Alan Modra
0 siblings, 0 replies; only message in thread
From: Alan Modra @ 2022-07-20 3:06 UTC (permalink / raw)
To: bfd-cvs
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=ffd29c9c21422ddacdd66ead68ee060ac01a28c5
commit ffd29c9c21422ddacdd66ead68ee060ac01a28c5
Author: Dmitry Selyutin <ghostmansd@gmail.com>
Date: Mon Jul 18 12:46:53 2022 +0300
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.
Diff:
---
gas/doc/internals.texi | 6 ++++++
gas/symbols.c | 39 +++++++++++++++++++++++++++++++++++++++
2 files changed, 45 insertions(+)
diff --git a/gas/doc/internals.texi b/gas/doc/internals.texi
index 9221801f635..59b2d3acee5 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 6904a3102cf..81383a5e8cb 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. */
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-07-20 3:06 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-20 3:06 [binutils-gdb] gas/symbols: introduce md_resolve_symbol Alan Modra
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).