[binutils-gdb] PR24411, Division is not accepted in MEMORY length expression

Alan Modra amodra@sourceware.org
Wed Apr 3 02:42:00 GMT 2019


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=1c6aafe894645ca1da5c0dd0661bca19caf37ad0

commit 1c6aafe894645ca1da5c0dd0661bca19caf37ad0
Author: Alan Modra <amodra@gmail.com>
Date:   Wed Apr 3 11:21:36 2019 +1030

    PR24411, Division is not accepted in MEMORY length expression
    
    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.

Diff:
---
 ld/ChangeLog | 6 ++++++
 ld/ldlex.l   | 6 +++++-
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/ld/ChangeLog b/ld/ChangeLog
index 851bffb..bc35b34 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,5 +1,11 @@
 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.
 	(CMDFILENAMECHAR, CMDFILENAMECHAR1): Delete.
 	(FILENAMECHAR1, SYMBOLNAMECHAR1, FILENAMECHAR, WILDCHAR),
diff --git a/ld/ldlex.l b/ld/ldlex.l
index 6e73a7f..c2abc59 100644
--- a/ld/ldlex.l
+++ b/ld/ldlex.l
@@ -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;



More information about the Binutils-cvs mailing list