PR24411, Division is not accepted in MEMORY length expression
authorAlan Modra <amodra@gmail.com>
Wed, 3 Apr 2019 00:51:36 +0000 (11:21 +1030)
committerAlan Modra <amodra@gmail.com>
Wed, 3 Apr 2019 02:31:49 +0000 (13:01 +1030)
Let's hope no one has section names starting with '/' in scripts.  If
they do, this change to fix parsing of '/' in expressiongs will break
their project.

PR 24411
ldlex.l (SYMBOLNAMECHAR1): Don't match '/'.
(<EXPRESSION>"/DISCARD/"): New.

ld/ChangeLog
ld/ldlex.l

index 851bffbe86ff21c1ea58f890caaf5d639dc7e216..bc35b349dcfa740dc3f793c856117754f2bd6f7e 100644 (file)
@@ -1,3 +1,9 @@
+2019-04-03  Alan Modra  <amodra@gmail.com>
+
+       PR 24411
+       ldlex.l (SYMBOLNAMECHAR1): Don't match '/'.
+       (<EXPRESSION>"/DISCARD/"): New.
+
 2019-04-03  Alan Modra  <amodra@gmail.com>
 
        * ldlex.l: Formatting.
index 6e73a7fb65b73ffb83c2faa06f7672e4c9ae339f..c2abc59571dd9357e7cb75807ef959011f12e414 100644 (file)
@@ -96,7 +96,7 @@ FILENAMECHAR  [_a-zA-Z0-9\/\.\\\$\~\-\+\:\[\]\,\=]
 NOCFILENAMECHAR        [_a-zA-Z0-9\/\.\\\$\~\-\+\:\[\]]
 SYMBOLNAMECHAR  [_a-zA-Z0-9\/\.\\\$\~]
 FILENAMECHAR1  [_a-zA-Z\/\.\\\$\~]
-SYMBOLNAMECHAR1        [_a-zA-Z\/\.\\\$]
+SYMBOLNAMECHAR1        [_a-zA-Z\.\\\$]
 WHITE          [ \t\n\r]+
 
 V_TAG [.$_a-zA-Z][._a-zA-Z0-9]*
@@ -388,6 +388,10 @@ V_IDENTIFIER [*?.$_a-zA-Z\[\]\-\!\^\\]([*?.$_a-zA-Z0-9\[\]\-\!\^\\]|::)*
                                  yylval.name = xstrdup (yytext);
                                  return NAME;
                                }
+<EXPRESSION>"/DISCARD/"                {
+                                 yylval.name = xstrdup (yytext);
+                                 return NAME;
+                               }
 <EXPRESSION>"-l"{NOCFILENAMECHAR}+ {
                                  yylval.name = xstrdup (yytext + 2);
                                  return LNAME;