From f4ae97e1bdfeddfb9ea2f006f1b6e18bc94ecbad Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Mon, 16 Jun 1997 16:56:22 +0000 Subject: Mon Jun 16 12:49:36 1997 H.J. Lu * ldlang.c (lang_place_undefineds): Add \n in einfo call. (lang_size_sections): Likewise. * ldlex.l: Likewise. * emultempl/aix.em (gld${EMULATION_NAME}_read_file): Likewise. * emultempl/mipsecoff.em (gld${EMULATION_NAME}_after_open): Likewise. (check_sections): Likewise. (gld${EMULATION_NAME}_after_allocation): Likewise. * emultempl/pe.em (gld_$${EMULATION_NAME}_before_allocation): Likewise. * mpw-eppcmac.c (gldppcmacos_read_file): Likewise. * mpw-idtmips.c (gldmipsidt_after_open): Likewise. (check_sections): Likewise. (gldmipsidt_after_allocation): Likewise. --- ld/ldlex.l | 61 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 56 insertions(+), 5 deletions(-) (limited to 'ld/ldlex.l') diff --git a/ld/ldlex.l b/ld/ldlex.l index 681988d..e821494 100644 --- a/ld/ldlex.l +++ b/ld/ldlex.l @@ -1,6 +1,6 @@ %{ -/* Copyright (C) 1991, 92, 93, 94, 95, 1996 Free Software Foundation, Inc. +/* Copyright (C) 1991, 92, 93, 94, 95, 96, 1997 Free Software Foundation, Inc. This file is part of GLD, the Gnu Linker. @@ -89,6 +89,9 @@ static void lex_warn_invalid PARAMS ((char *where, char *what)); BOTH either EXPRESSION or SCRIPT DEFSYMEXP in an argument to -defsym 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 */ #define RTOKEN(x) { yylval.token = x; return x; } @@ -104,19 +107,24 @@ int yywrap () { return 1; } CMDFILENAMECHAR [_a-zA-Z0-9\/\.\\_\+\$\:\[\]\\\,\=\&\!\<\>\-\~] CMDFILENAMECHAR1 [_a-zA-Z0-9\/\.\\_\+\$\:\[\]\\\,\=\&\!\<\>\~] FILENAMECHAR1 [_a-zA-Z\/\.\\\$\_\~] -SYMBOLCHARN [_a-zA-Z\/\.\\0-9] +SYMBOLCHARN [_a-zA-Z\/\.\\\$\_\~0-9] FILENAMECHAR [_a-zA-Z0-9\/\.\-\_\+\=\$\:\[\]\\\,\~] WILDCHAR [_a-zA-Z0-9\/\.\-\_\+\=\$\:\[\]\\\,\~\?\*] 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]* %s SCRIPT %s EXPRESSION %s BOTH %s DEFSYMEXP %s MRI +%s VERS_START +%s VERS_SCRIPT +%s VERS_NODE %% if (parser_input != input_selected) @@ -128,6 +136,7 @@ NOCFILENAMECHAR [_a-zA-Z0-9\/\.\-\_\+\$\:\[\]\\\~] { case input_script: return INPUT_SCRIPT; break; case input_mri_script: return INPUT_MRI_SCRIPT; break; + case input_version_script: return INPUT_VERSION_SCRIPT; break; case input_defsym: return INPUT_DEFSYM; break; default: abort (); } @@ -223,12 +232,15 @@ NOCFILENAMECHAR [_a-zA-Z0-9\/\.\-\_\+\$\:\[\]\\\~] ";" { RTOKEN(';');} "MEMORY" { RTOKEN(MEMORY);} "ORIGIN" { RTOKEN(ORIGIN);} +"VERSION" { RTOKEN(VERSION);} "BLOCK" { RTOKEN(BLOCK);} "BIND" { RTOKEN(BIND);} "LENGTH" { RTOKEN(LENGTH);} "ALIGN" { RTOKEN(ALIGN_K);} "ADDR" { RTOKEN(ADDR);} "LOADADDR" { RTOKEN(LOADADDR);} +"MAX" { RTOKEN(MAX); } +"MIN" { RTOKEN(MIN); } "ENTRY" { RTOKEN(ENTRY);} "NEXT" { RTOKEN(NEXT);} "sizeof_headers" { RTOKEN(SIZEOF_HEADERS);} @@ -253,11 +265,13 @@ NOCFILENAMECHAR [_a-zA-Z0-9\/\.\-\_\+\$\:\[\]\\\~] "SYSLIB" { RTOKEN(SYSLIB);} "FLOAT" { RTOKEN(FLOAT);} "QUAD" { RTOKEN( QUAD);} +"SQUAD" { RTOKEN( SQUAD);} "LONG" { RTOKEN( LONG);} "SHORT" { RTOKEN( SHORT);} "BYTE" { RTOKEN( BYTE);} "NOFLOAT" { RTOKEN(NOFLOAT);} -"NOCROSSREFS" { RTOKEN(NOCROSSREFS);} +"NOCROSSREFS" { RTOKEN(NOCROSSREFS);} +"OVERLAY" { RTOKEN(OVERLAY); } "NOLOAD" { RTOKEN(NOLOAD);} "DSECT" { RTOKEN(DSECT);} "COPY" { RTOKEN(COPY);} @@ -341,6 +355,29 @@ NOCFILENAMECHAR [_a-zA-Z0-9\/\.\-\_\+\$\:\[\]\\\~] "\r" { lineno++;} [ \t] +[:,;] { return *yytext; } + +global { RTOKEN(GLOBAL); } + +local { RTOKEN(LOCAL); } + +{V_IDENTIFIER} { yylval.name = buystring (yytext); + return VERS_IDENTIFIER; } + +{V_TAG} { yylval.name = buystring (yytext); + return VERS_TAG; } + +"{" { BEGIN(VERS_SCRIPT); return *yytext; } + +"{" { BEGIN(VERS_NODE); return *yytext; } +"}" { BEGIN(VERS_SCRIPT); return *yytext; } + +[\n\r] { lineno++; } + +#.* { /* Eat up comments */ } + +[ \t]+ { /* Eat up whitespace */ } + <> { include_stack_ptr--; @@ -360,7 +397,7 @@ NOCFILENAMECHAR [_a-zA-Z0-9\/\.\-\_\+\$\:\[\]\\\~] return END; } -. lex_warn_invalid(" in script", yytext); +. lex_warn_invalid(" in script", yytext); . lex_warn_invalid(" in expression", yytext); %% @@ -469,6 +506,20 @@ ldlex_mri_script () } void +ldlex_version_script () +{ + *(state_stack_p)++ = yy_start; + BEGIN (VERS_START); +} + +void +ldlex_version_file () +{ + *(state_stack_p)++ = yy_start; + BEGIN (VERS_SCRIPT); +} + +void ldlex_defsym () { *(state_stack_p)++ = yy_start; @@ -512,7 +563,7 @@ yy_input (buf, result, max_size) { *result = read (fileno (yyin), (char *) buf, max_size); if (*result < 0) - einfo ("%F%P: read in flex scanner failed"); + einfo ("%F%P: read in flex scanner failed\n"); } } } -- cgit v1.1