This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [PATCH] Eat newlines in INPUT statements
- From: "H.J. Lu" <hjl dot tools at gmail dot com>
- To: Andreas Schwab <schwab at linux-m68k dot org>
- Cc: Binutils <binutils at sourceware dot org>
- Date: Tue, 28 Apr 2015 12:31:44 -0700
- Subject: Re: [PATCH] Eat newlines in INPUT statements
- Authentication-results: sourceware.org; auth=none
- References: <87k2ww2gsc dot fsf at igel dot home> <CAMe9rOoeMiOayeZDT4JJL3XYfNE=3w02fAzt_GXDXhQcJCbHQg at mail dot gmail dot com>
On Tue, Apr 28, 2015 at 12:30 PM, H.J. Lu <hjl.tools@gmail.com> wrote:
> On Tue, Apr 28, 2015 at 12:29 PM, Andreas Schwab <schwab@linux-m68k.org> wrote:
>> The ld-script lexer didn't have a rule for newlines inside INPUT
>> statements, so it fell through to the default action which is to print
>> the current input to stdout.
>>
>> Andreas.
>>
>> PR ld/18344
>> * ldlex.l (INPUTLIST): Increment lineno on newline.
>> ---
>> ld/ldlex.l | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/ld/ldlex.l b/ld/ldlex.l
>> index a19c5d6..d9ef830 100644
>> --- a/ld/ldlex.l
>> +++ b/ld/ldlex.l
>> @@ -450,7 +450,7 @@ V_IDENTIFIER [*?.$_a-zA-Z\[\]\-\!\^\\]([*?.$_a-zA-Z0-9\[\]\-\!\^\\]|::)*
>> return *yytext;
>> }
>>
>> -<VERS_START,VERS_NODE,VERS_SCRIPT>[\n] { lineno++; }
>> +<VERS_START,VERS_NODE,VERS_SCRIPT,INPUTLIST>[\n] { lineno++; }
>>
>> <VERS_START,VERS_NODE,VERS_SCRIPT>#.* { /* Eat up comments */ }
>>
>> --
>> 2.3.7
>
> Looks good to me. I think it counts as obvious.
>
> Thanks.
FWIW, I have
diff --git a/ld/ldlex.l b/ld/ldlex.l
index a19c5d6..e94cdb0 100644
--- a/ld/ldlex.l
+++ b/ld/ldlex.l
@@ -420,7 +420,7 @@ V_IDENTIFIER
[*?.$_a-zA-Z\[\]\-\!\^\\]([*?.$_a-zA-Z0-9\[\]\-\!\^\\]|::)*
yylval.name[yyleng - 2] = 0;
return NAME;
}
-<BOTH,SCRIPT,EXPRESSION>"\n" { lineno++;}
+<BOTH,SCRIPT,EXPRESSION,INPUTLIST>"\n" { lineno++;}
<MRI,BOTH,SCRIPT,EXPRESSION>[ \t\r]+ { }
<VERS_NODE,VERS_SCRIPT>[:,;] { return *yytext; }
They are equivalent.
--
H.J.