From: Alan Modra Date: Wed, 11 Aug 2021 00:41:19 +0000 (+0930) Subject: Revert "ld script expression parsing" X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=dd713144aa067fbaa5dbf6442a441bcd38204ec1;p=thirdparty%2Fbinutils-gdb.git Revert "ld script expression parsing" This reverts commit 40726f16a8d7105761e36398054860a923d4efc9. --- diff --git a/ld/ChangeLog b/ld/ChangeLog index f546c792ecc..5048b5b6a17 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -999,14 +999,6 @@ * configure.tgt: Add *-*-genode* as a target for AArch64 and x86. -2021-02-01 Alan Modra - - * ldgram.y (section): Call ldlex_backup. Remove empty action. - * ldlex.h (ldlex_backup): Declare. - * ldlex.l (NAME): Don't use NOCFILENAMECHAR set of - chars, use SYMBOLNAMECHAR. - (ldlex_backup): New function. - 2021-02-01 Alan Modra * ldgram.y: Whitespace fixes. diff --git a/ld/ldgram.y b/ld/ldgram.y index 6508393db63..7f8f03570dc 100644 --- a/ld/ldgram.y +++ b/ld/ldgram.y @@ -1071,15 +1071,11 @@ section: NAME { ldlex_expression(); } '}' { ldlex_popstate (); ldlex_expression (); } memspec_opt memspec_at_opt phdr_opt fill_opt { - if (yychar == NAME) - { - yyclearin; - ldlex_backup (); - } ldlex_popstate (); lang_leave_output_section_statement ($18, $15, $17, $16); } opt_comma + {} | OVERLAY { ldlex_expression (); } opt_exp_without_type opt_nocrossrefs opt_at opt_subalign @@ -1093,11 +1089,6 @@ section: NAME { ldlex_expression(); } { ldlex_popstate (); ldlex_expression (); } memspec_opt memspec_at_opt phdr_opt fill_opt { - if (yychar == NAME) - { - yyclearin; - ldlex_backup (); - } ldlex_popstate (); lang_leave_overlay ($5, (int) $4, $16, $13, $15, $14); diff --git a/ld/ldlex.h b/ld/ldlex.h index ddf00b2fa18..f035ce8ae4d 100644 --- a/ld/ldlex.h +++ b/ld/ldlex.h @@ -193,7 +193,6 @@ extern void ldlex_defsym (void); extern void ldlex_expression (void); extern void ldlex_both (void); extern void ldlex_popstate (void); -extern void ldlex_backup (void); extern const char* ldlex_filename (void); /* In lexsup.c. */ diff --git a/ld/ldlex.l b/ld/ldlex.l index 7652e8d2a29..237892c0ec3 100644 --- a/ld/ldlex.l +++ b/ld/ldlex.l @@ -385,7 +385,7 @@ V_IDENTIFIER [*?.$_a-zA-Z\[\]\-\!\^\\]([*?.$_a-zA-Z0-9\[\]\-\!\^\\]|::)* yylval.name = xstrdup (yytext + 2); return LNAME; } -{SYMBOLNAMECHAR1}{SYMBOLNAMECHAR}* { +{SYMBOLNAMECHAR1}{NOCFILENAMECHAR}* { yylval.name = xstrdup (yytext); return NAME; } @@ -636,16 +636,6 @@ ldlex_popstate (void) yy_start = *(--state_stack_p); } -/* In cases where the parser needs to look ahead and the context - changes from expression to script or vice-versa, throw away a - NAME. What constitutes a NAME depends on context. */ - -void -ldlex_backup (void) -{ - yyless (0); -} - /* Return the current file name, or the previous file if no file is current. */