diff options
Diffstat (limited to 'ld/ldlex.l')
-rw-r--r-- | ld/ldlex.l | 32 |
1 files changed, 23 insertions, 9 deletions
@@ -77,6 +77,7 @@ static void lex_warn_invalid (char *where, char *what); /* STATES EXPRESSION definitely in an expression SCRIPT definitely in a script + INPUTLIST definitely in a script, a filename-list BOTH either EXPRESSION or SCRIPT DEFSYMEXP in an argument to -defsym MRI in an MRI script @@ -109,6 +110,7 @@ V_TAG [.$_a-zA-Z][._a-zA-Z0-9]* V_IDENTIFIER [*?.$_a-zA-Z\[\]\-\!\^\\]([*?.$_a-zA-Z0-9\[\]\-\!\^\\]|::)* %s SCRIPT +%s INPUTLIST %s EXPRESSION %s BOTH %s DEFSYMEXP @@ -134,7 +136,7 @@ V_IDENTIFIER [*?.$_a-zA-Z\[\]\-\!\^\\]([*?.$_a-zA-Z0-9\[\]\-\!\^\\]|::)* } } -<BOTH,SCRIPT,EXPRESSION,VERS_START,VERS_NODE,VERS_SCRIPT>"/*" { comment (); } +<BOTH,SCRIPT,EXPRESSION,VERS_START,VERS_NODE,VERS_SCRIPT,INPUTLIST>"/*" { comment (); } <DEFSYMEXP>"-" { RTOKEN('-');} @@ -221,7 +223,7 @@ V_IDENTIFIER [*?.$_a-zA-Z\[\]\-\!\^\\]([*?.$_a-zA-Z0-9\[\]\-\!\^\\]|::)* <BOTH,SCRIPT,EXPRESSION,MRI>"|=" { RTOKEN(OREQ);} <BOTH,SCRIPT,EXPRESSION,MRI>"&&" { RTOKEN(ANDAND);} <BOTH,SCRIPT,EXPRESSION,MRI>">" { RTOKEN('>');} -<BOTH,SCRIPT,EXPRESSION,MRI>"," { RTOKEN(',');} +<BOTH,SCRIPT,EXPRESSION,MRI,INPUTLIST>"," { RTOKEN(',');} <BOTH,SCRIPT,EXPRESSION,MRI>"&" { RTOKEN('&');} <BOTH,SCRIPT,EXPRESSION,MRI>"|" { RTOKEN('|');} <BOTH,SCRIPT,EXPRESSION,MRI>"~" { RTOKEN('~');} @@ -236,8 +238,8 @@ V_IDENTIFIER [*?.$_a-zA-Z\[\]\-\!\^\\]([*?.$_a-zA-Z0-9\[\]\-\!\^\\]|::)* <BOTH,SCRIPT,EXPRESSION,MRI>"=" { RTOKEN('=');} <BOTH,SCRIPT,EXPRESSION,MRI>"}" { RTOKEN('}') ; } <BOTH,SCRIPT,EXPRESSION,MRI>"{" { RTOKEN('{'); } -<BOTH,SCRIPT,EXPRESSION,MRI>")" { RTOKEN(')');} -<BOTH,SCRIPT,EXPRESSION,MRI>"(" { RTOKEN('(');} +<BOTH,SCRIPT,EXPRESSION,MRI,INPUTLIST>")" { RTOKEN(')');} +<BOTH,SCRIPT,EXPRESSION,MRI,INPUTLIST>"(" { RTOKEN('(');} <BOTH,SCRIPT,EXPRESSION,MRI>":" { RTOKEN(':'); } <BOTH,SCRIPT,EXPRESSION,MRI>";" { RTOKEN(';');} <BOTH,SCRIPT>"MEMORY" { RTOKEN(MEMORY);} @@ -272,7 +274,7 @@ V_IDENTIFIER [*?.$_a-zA-Z\[\]\-\!\^\\]([*?.$_a-zA-Z0-9\[\]\-\!\^\\]|::)* <BOTH,SCRIPT>"OUTPUT" { RTOKEN(OUTPUT);} <BOTH,SCRIPT>"INPUT" { RTOKEN(INPUT);} <EXPRESSION,BOTH,SCRIPT>"GROUP" { RTOKEN(GROUP);} -<EXPRESSION,BOTH,SCRIPT>"AS_NEEDED" { RTOKEN(AS_NEEDED);} +<EXPRESSION,BOTH,SCRIPT,INPUTLIST>"AS_NEEDED" { RTOKEN(AS_NEEDED);} <EXPRESSION,BOTH,SCRIPT>"DEFINED" { RTOKEN(DEFINED);} <BOTH,SCRIPT>"CREATE_OBJECT_SYMBOLS" { RTOKEN(CREATE_OBJECT_SYMBOLS);} <BOTH,SCRIPT>"CONSTRUCTORS" { RTOKEN( CONSTRUCTORS);} @@ -373,11 +375,16 @@ V_IDENTIFIER [*?.$_a-zA-Z\[\]\-\!\^\\]([*?.$_a-zA-Z0-9\[\]\-\!\^\\]|::)* } -<BOTH>{FILENAMECHAR1}{FILENAMECHAR}* { +<BOTH,INPUTLIST>{FILENAMECHAR1}{FILENAMECHAR}* { yylval.name = xstrdup (yytext); return NAME; } -<BOTH>"-l"{FILENAMECHAR}+ { +<INPUTLIST>"="{FILENAMECHAR1}{FILENAMECHAR}* { +/* Filename to be prefixed by --sysroot or when non-sysrooted, nothing. */ + yylval.name = xstrdup (yytext); + return NAME; + } +<BOTH,INPUTLIST>"-l"{FILENAMECHAR}+ { yylval.name = xstrdup (yytext + 2); return LNAME; } @@ -406,7 +413,7 @@ V_IDENTIFIER [*?.$_a-zA-Z\[\]\-\!\^\\]([*?.$_a-zA-Z0-9\[\]\-\!\^\\]|::)* } } -<EXPRESSION,BOTH,SCRIPT,VERS_NODE>"\""[^\"]*"\"" { +<EXPRESSION,BOTH,SCRIPT,VERS_NODE,INPUTLIST>"\""[^\"]*"\"" { /* No matter the state, quotes give what's inside */ yylval.name = xstrdup (yytext + 1); @@ -447,7 +454,7 @@ V_IDENTIFIER [*?.$_a-zA-Z\[\]\-\!\^\\]([*?.$_a-zA-Z0-9\[\]\-\!\^\\]|::)* <VERS_START,VERS_NODE,VERS_SCRIPT>#.* { /* Eat up comments */ } -<VERS_START,VERS_NODE,VERS_SCRIPT>[ \t\r]+ { /* Eat up whitespace */ } +<VERS_START,VERS_NODE,VERS_SCRIPT,INPUTLIST>[ \t\r]+ { /* Eat up whitespace */ } <<EOF>> { include_stack_ptr--; @@ -566,6 +573,13 @@ ldlex_script (void) } void +ldlex_inputlist (void) +{ + *(state_stack_p)++ = yy_start; + BEGIN (INPUTLIST); +} + +void ldlex_mri_script (void) { *(state_stack_p)++ = yy_start; |