aboutsummaryrefslogtreecommitdiff
path: root/ld/ldlex.l
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2021-01-30 09:05:50 +1030
committerAlan Modra <amodra@gmail.com>2021-02-02 01:27:12 +1030
commitfb6c220ebdae893d7d955827363010342fa1afa5 (patch)
tree72f615ae32e85635b5a6082e5839d155605b48b3 /ld/ldlex.l
parent40726f16a8d7105761e36398054860a923d4efc9 (diff)
downloadgdb-fb6c220ebdae893d7d955827363010342fa1afa5.zip
gdb-fb6c220ebdae893d7d955827363010342fa1afa5.tar.gz
gdb-fb6c220ebdae893d7d955827363010342fa1afa5.tar.bz2
ld --defsym
This makes --defsym support the same expressions as assignment in a script. For example, --defsym 'HIDDEN(foo=0)', will define a hidden visibility foo. * ldgram.y (defsym_expr): Use assignment rule. * ldlex.h (ldlex_defsym): Delete. * ldlex.l (DEFSYMEXP, ldlex_defsym): Delete.
Diffstat (limited to 'ld/ldlex.l')
-rw-r--r--ld/ldlex.l19
1 files changed, 2 insertions, 17 deletions
diff --git a/ld/ldlex.l b/ld/ldlex.l
index 7652e8d..c1b1526 100644
--- a/ld/ldlex.l
+++ b/ld/ldlex.l
@@ -79,7 +79,6 @@ static void lex_warn_invalid (char *where, char *what);
SCRIPT definitely in a script
INPUTLIST definitely in a script, a filename-list
BOTH either EXPRESSION or SCRIPT
- DEFSYMEXP in an argument to -defsym
MRI in an MRI script
VERS_START starting a Sun style mapfile
VERS_SCRIPT a Sun style mapfile
@@ -107,7 +106,6 @@ V_IDENTIFIER [*?.$_a-zA-Z\[\]\-\!\^\\]([*?.$_a-zA-Z0-9\[\]\-\!\^\\]|::)*
%s INPUTLIST
%s EXPRESSION
%s BOTH
-%s DEFSYMEXP
%s MRI
%s VERS_START
%s VERS_SCRIPT
@@ -133,12 +131,6 @@ V_IDENTIFIER [*?.$_a-zA-Z\[\]\-\!\^\\]([*?.$_a-zA-Z0-9\[\]\-\!\^\\]|::)*
<BOTH,SCRIPT,EXPRESSION,VERS_START,VERS_NODE,VERS_SCRIPT,INPUTLIST>"/*" { comment (); }
-<DEFSYMEXP>"-" { RTOKEN('-');}
-<DEFSYMEXP>"+" { RTOKEN('+');}
-<DEFSYMEXP>{SYMBOLNAMECHAR1}{SYMBOLNAMECHAR}* { yylval.name = xstrdup (yytext);
- return NAME; }
-<DEFSYMEXP>"=" { RTOKEN('='); }
-
<MRI,EXPRESSION>"$"([0-9A-Fa-f])+ {
yylval.integer = bfd_scan_vma (yytext + 1, 0, 16);
yylval.bigint.str = NULL;
@@ -170,7 +162,7 @@ V_IDENTIFIER [*?.$_a-zA-Z\[\]\-\!\^\\]([*?.$_a-zA-Z0-9\[\]\-\!\^\\]|::)*
yylval.bigint.str = NULL;
return INT;
}
-<SCRIPT,DEFSYMEXP,MRI,BOTH,EXPRESSION>((("$"|0[xX])([0-9A-Fa-f])+)|(([0-9])+))(M|K|m|k)? {
+<SCRIPT,MRI,BOTH,EXPRESSION>((("$"|0[xX])([0-9A-Fa-f])+)|(([0-9])+))(M|K|m|k)? {
char *s = yytext;
int ibase = 0;
@@ -480,7 +472,7 @@ V_IDENTIFIER [*?.$_a-zA-Z\[\]\-\!\^\\]([*?.$_a-zA-Z0-9\[\]\-\!\^\\]|::)*
}
<SCRIPT,MRI,VERS_START,VERS_SCRIPT,VERS_NODE>. lex_warn_invalid (" in script", yytext);
-<EXPRESSION,DEFSYMEXP,BOTH>. lex_warn_invalid (" in expression", yytext);
+<EXPRESSION,BOTH>. lex_warn_invalid (" in expression", yytext);
%%
@@ -610,13 +602,6 @@ ldlex_version_file (void)
}
void
-ldlex_defsym (void)
-{
- *(state_stack_p)++ = yy_start;
- BEGIN (DEFSYMEXP);
-}
-
-void
ldlex_expression (void)
{
*(state_stack_p)++ = yy_start;