summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2021-08-11 18:16:35 +0930
committerAlan Modra <amodra@gmail.com>2021-08-11 19:46:43 +0930
commitcc9faa98adc96788e6a560c685bbd8e69c856cb7 (patch)
tree7fdee9cb10ca0ed1150c0d61278f9179af298793
parent6c93cebf2dd6ed203efe01e2c696fbb2c44ff42d (diff)
downloadbinutils-gdb-cc9faa98adc96788e6a560c685bbd8e69c856cb7.tar.gz
PR28198, Support # as linker script comment marker
PR 28198 * ldlex.l: Combine rules for handling newline, whitespace and comments. Extend # comment handling to all states.
-rw-r--r--ld/ldlex.l15
1 files changed, 7 insertions, 8 deletions
diff --git a/ld/ldlex.l b/ld/ldlex.l
index 25b4bcaae01..f588bd3adc5 100644
--- a/ld/ldlex.l
+++ b/ld/ldlex.l
@@ -420,8 +420,13 @@ V_IDENTIFIER [*?.$_a-zA-Z\[\]\-\!\^\\]([*?.$_a-zA-Z0-9\[\]\-\!\^\\]|::)*
yylval.name[len] = 0;
return NAME;
}
-<BOTH,SCRIPT,EXPRESSION>"\n" { lineno++;}
-<MRI,BOTH,SCRIPT,EXPRESSION>[ \t\r]+ { }
+
+<BOTH,SCRIPT,EXPRESSION,VERS_START,VERS_NODE,VERS_SCRIPT,INPUTLIST>"\n" {
+ lineno++; }
+<MRI,BOTH,SCRIPT,EXPRESSION,VERS_START,VERS_NODE,VERS_SCRIPT,INPUTLIST>[ \t\r]+ {
+ /* Eat up whitespace */ }
+<BOTH,SCRIPT,EXPRESSION,VERS_START,VERS_NODE,VERS_SCRIPT>#.* {
+ /* Eat up comments */ }
<VERS_NODE,VERS_SCRIPT>[:,;] { return *yytext; }
@@ -450,12 +455,6 @@ V_IDENTIFIER [*?.$_a-zA-Z\[\]\-\!\^\\]([*?.$_a-zA-Z0-9\[\]\-\!\^\\]|::)*
return *yytext;
}
-<VERS_START,VERS_NODE,VERS_SCRIPT,INPUTLIST>[\n] { lineno++; }
-
-<VERS_START,VERS_NODE,VERS_SCRIPT>#.* { /* Eat up comments */ }
-
-<VERS_START,VERS_NODE,VERS_SCRIPT,INPUTLIST>[ \t\r]+ { /* Eat up whitespace */ }
-
<<EOF>> {
include_stack_ptr--;
if (include_stack_ptr == 0)