X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=ld%2Fldlex.l;h=44148cef3cfa40744c1b1199e381bba5bcbff74a;hb=0b11474080800192797236e30857a42818f5560d;hp=fd508564a22471a6818e6cfb289f378c0feece29;hpb=d003af558092dc521f93d16628b9ccbf434370e3;p=deliverable%2Fbinutils-gdb.git diff --git a/ld/ldlex.l b/ld/ldlex.l index fd508564a2..44148cef3c 100644 --- a/ld/ldlex.l +++ b/ld/ldlex.l @@ -2,7 +2,7 @@ %{ -/* Copyright (C) 1991-2017 Free Software Foundation, Inc. +/* Copyright (C) 1991-2019 Free Software Foundation, Inc. Written by Steve Chamberlain of Cygnus Support. This file is part of the GNU Binutils. @@ -25,6 +25,7 @@ #include "bfd.h" #include "safe-ctype.h" #include "bfdlink.h" +#include "ctf-api.h" #include "ld.h" #include "ldmisc.h" #include "ldexp.h" @@ -79,7 +80,7 @@ static void lex_warn_invalid (char *where, char *what); INPUTLIST definitely in a script, a filename-list BOTH either EXPRESSION or SCRIPT DEFSYMEXP in an argument to -defsym - MRI in an MRI script + MRI in an MRI script VERS_START starting a Sun style mapfile VERS_SCRIPT a Sun style mapfile VERS_NODE a node within a Sun style mapfile @@ -91,17 +92,14 @@ static void lex_warn_invalid (char *where, char *what); %a 4000 %o 5000 -CMDFILENAMECHAR [_a-zA-Z0-9\/\.\\_\+\$\:\[\]\\\,\=\&\!\<\>\-\~] -CMDFILENAMECHAR1 [_a-zA-Z0-9\/\.\\_\+\$\:\[\]\\\,\=\&\!\<\>\~] -FILENAMECHAR1 [_a-zA-Z\/\.\\\$\_\~] -SYMBOLNAMECHAR1 [_a-zA-Z\/\.\\\$\_] -SYMBOLCHARN [_a-zA-Z\/\.\\\$\_\~0-9] -FILENAMECHAR [_a-zA-Z0-9\/\.\-\_\+\=\$\:\[\]\\\,\~] -WILDCHAR [_a-zA-Z0-9\/\.\-\_\+\=\$\:\[\]\\\,\~\?\*\^\!] +WILDCHAR [_a-zA-Z0-9\/\.\\\$\~\-\+\:\[\]\,\=\?\*\^\!] +FILENAMECHAR [_a-zA-Z0-9\/\.\\\$\~\-\+\:\[\]\,\=] +NOCFILENAMECHAR [_a-zA-Z0-9\/\.\\\$\~\-\+\:\[\]] +SYMBOLNAMECHAR [_a-zA-Z0-9\/\.\\\$\~] +FILENAMECHAR1 [_a-zA-Z\/\.\\\$\~] +SYMBOLNAMECHAR1 [_a-zA-Z\.\\\$] WHITE [ \t\n\r]+ -NOCFILENAMECHAR [_a-zA-Z0-9\/\.\-\_\+\$\:\[\]\\\~] - V_TAG [.$_a-zA-Z][._a-zA-Z0-9]* V_IDENTIFIER [*?.$_a-zA-Z\[\]\-\!\^\\]([*?.$_a-zA-Z0-9\[\]\-\!\^\\]|::)* @@ -135,13 +133,14 @@ V_IDENTIFIER [*?.$_a-zA-Z\[\]\-\!\^\\]([*?.$_a-zA-Z0-9\[\]\-\!\^\\]|::)* "/*" { comment (); } -"-" { RTOKEN('-');} -"+" { RTOKEN('+');} -{SYMBOLNAMECHAR1}{SYMBOLCHARN}* { yylval.name = xstrdup (yytext); return NAME; } -"=" { RTOKEN('='); } +"-" { RTOKEN('-');} +"+" { RTOKEN('+');} +{SYMBOLNAMECHAR1}{SYMBOLNAMECHAR}* { yylval.name = xstrdup (yytext); + return NAME; } +"=" { RTOKEN('='); } "$"([0-9A-Fa-f])+ { - yylval.integer = bfd_scan_vma (yytext + 1, 0, 16); + yylval.integer = bfd_scan_vma (yytext + 1, 0, 16); yylval.bigint.str = NULL; return INT; } @@ -231,7 +230,7 @@ V_IDENTIFIER [*?.$_a-zA-Z\[\]\-\!\^\\]([*?.$_a-zA-Z0-9\[\]\-\!\^\\]|::)* "/" { RTOKEN('/');} "%" { RTOKEN('%');} "<" { RTOKEN('<');} -"=" { RTOKEN('=');} +"=" { RTOKEN('=');} "}" { RTOKEN('}') ; } "{" { RTOKEN('{'); } ")" { RTOKEN(')');} @@ -327,72 +326,71 @@ V_IDENTIFIER [*?.$_a-zA-Z\[\]\-\!\^\\]([*?.$_a-zA-Z0-9\[\]\-\!\^\\]|::)* "EXCLUDE_FILE" { RTOKEN(EXCLUDE_FILE); } "CONSTANT" { RTOKEN(CONSTANT);} "#".*\n? { ++ lineno; } -"\n" { ++ lineno; RTOKEN(NEWLINE); } +"\n" { ++ lineno; RTOKEN(NEWLINE); } "*".* { /* Mri comment line */ } ";".* { /* Mri comment line */ } -"END" { RTOKEN(ENDWORD); } +"END" { RTOKEN(ENDWORD); } "ALIGNMOD" { RTOKEN(ALIGNMOD);} "ALIGN" { RTOKEN(ALIGN_K);} -"CHIP" { RTOKEN(CHIP); } -"BASE" { RTOKEN(BASE); } -"ALIAS" { RTOKEN(ALIAS); } -"TRUNCATE" { RTOKEN(TRUNCATE); } -"LOAD" { RTOKEN(LOAD); } -"PUBLIC" { RTOKEN(PUBLIC); } -"ORDER" { RTOKEN(ORDER); } -"NAME" { RTOKEN(NAMEWORD); } -"FORMAT" { RTOKEN(FORMAT); } -"CASE" { RTOKEN(CASE); } -"START" { RTOKEN(START); } -"LIST".* { RTOKEN(LIST); /* LIST and ignore to end of line */ } +"CHIP" { RTOKEN(CHIP); } +"BASE" { RTOKEN(BASE); } +"ALIAS" { RTOKEN(ALIAS); } +"TRUNCATE" { RTOKEN(TRUNCATE); } +"LOAD" { RTOKEN(LOAD); } +"PUBLIC" { RTOKEN(PUBLIC); } +"ORDER" { RTOKEN(ORDER); } +"NAME" { RTOKEN(NAMEWORD); } +"FORMAT" { RTOKEN(FORMAT); } +"CASE" { RTOKEN(CASE); } +"START" { RTOKEN(START); } +"LIST".* { RTOKEN(LIST); /* LIST and ignore to end of line */ } "SECT" { RTOKEN(SECT); } "ABSOLUTE" { RTOKEN(ABSOLUTE); } -"end" { RTOKEN(ENDWORD); } +"end" { RTOKEN(ENDWORD); } "alignmod" { RTOKEN(ALIGNMOD);} "align" { RTOKEN(ALIGN_K);} -"chip" { RTOKEN(CHIP); } -"base" { RTOKEN(BASE); } -"alias" { RTOKEN(ALIAS); } -"truncate" { RTOKEN(TRUNCATE); } -"load" { RTOKEN(LOAD); } -"public" { RTOKEN(PUBLIC); } -"order" { RTOKEN(ORDER); } -"name" { RTOKEN(NAMEWORD); } -"format" { RTOKEN(FORMAT); } -"case" { RTOKEN(CASE); } -"extern" { RTOKEN(EXTERN); } -"start" { RTOKEN(START); } -"list".* { RTOKEN(LIST); /* LIST and ignore to end of line */ } +"chip" { RTOKEN(CHIP); } +"base" { RTOKEN(BASE); } +"alias" { RTOKEN(ALIAS); } +"truncate" { RTOKEN(TRUNCATE); } +"load" { RTOKEN(LOAD); } +"public" { RTOKEN(PUBLIC); } +"order" { RTOKEN(ORDER); } +"name" { RTOKEN(NAMEWORD); } +"format" { RTOKEN(FORMAT); } +"case" { RTOKEN(CASE); } +"extern" { RTOKEN(EXTERN); } +"start" { RTOKEN(START); } +"list".* { RTOKEN(LIST); /* LIST and ignore to end of line */ } "sect" { RTOKEN(SECT); } "absolute" { RTOKEN(ABSOLUTE); } {FILENAMECHAR1}{NOCFILENAMECHAR}* { /* Filename without commas, needed to parse mri stuff */ - yylval.name = xstrdup (yytext); + yylval.name = xstrdup (yytext); return NAME; } {FILENAMECHAR1}{FILENAMECHAR}* { - yylval.name = xstrdup (yytext); + yylval.name = xstrdup (yytext); return NAME; } "="{FILENAMECHAR1}{FILENAMECHAR}* { /* Filename to be prefixed by --sysroot or when non-sysrooted, nothing. */ - yylval.name = xstrdup (yytext); - return NAME; - } -"$SYSROOT"{FILENAMECHAR1}{FILENAMECHAR}* { -/* Filename to be prefixed by --sysroot or when non-sysrooted, nothing. */ - yylval.name = xstrdup (yytext); + yylval.name = xstrdup (yytext); return NAME; } "-l"{FILENAMECHAR}+ { yylval.name = xstrdup (yytext + 2); return LNAME; } -{SYMBOLNAMECHAR1}{NOCFILENAMECHAR}* { - yylval.name = xstrdup (yytext); +{SYMBOLNAMECHAR1}{NOCFILENAMECHAR}* { + yylval.name = xstrdup (yytext); + return NAME; + } +"/DISCARD/" { + yylval.name = xstrdup (yytext); return NAME; } "-l"{NOCFILENAMECHAR}+ { @@ -424,7 +422,7 @@ V_IDENTIFIER [*?.$_a-zA-Z\[\]\-\!\^\\]([*?.$_a-zA-Z0-9\[\]\-\!\^\\]|::)* /* PR ld/20906. A corrupt input file can contain bogus strings. */ len = strlen (yylval.name); - if (len > yyleng - 2) + if (len > (bfd_size_type) yyleng - 2) len = yyleng - 2; yylval.name[len] = 0; return NAME; @@ -463,7 +461,7 @@ V_IDENTIFIER [*?.$_a-zA-Z\[\]\-\!\^\\]([*?.$_a-zA-Z0-9\[\]\-\!\^\\]|::)* #.* { /* Eat up comments */ } -[ \t\r]+ { /* Eat up whitespace */ } +[ \t\r]+ { /* Eat up whitespace */ } <> { include_stack_ptr--; @@ -678,7 +676,7 @@ comment (void) while (1) { c = input(); - while (c != '*' && c != EOF) + while (c != '*' && c != 0) { if (c == '\n') lineno++; @@ -697,7 +695,7 @@ comment (void) if (c == '\n') lineno++; - if (c == EOF) + if (c == 0) { einfo (_("%F%P: EOF in comment\n")); break; @@ -729,5 +727,5 @@ lex_warn_invalid (char *where, char *what) what = buf; } - einfo (_("%P:%S: ignoring invalid character `%s'%s\n"), NULL, what, where); + einfo (_("%P:%pS: ignoring invalid character `%s'%s\n"), NULL, what, where); }