PR28198, Support # as linker script comment marker
Alan Modra
amodra@gmail.com
Wed Aug 11 10:16:22 GMT 2021
PR 28198
* ldlex.l: Combine rules for handling newline, whitespace and
comments. Extend # comment handling to all states.
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)
--
Alan Modra
Australia Development Lab, IBM
More information about the Binutils
mailing list