%{
-/* 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.
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; }
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)
{
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 ();
}
<BOTH,SCRIPT,EXPRESSION,MRI>";" { RTOKEN(';');}
<BOTH,SCRIPT>"MEMORY" { RTOKEN(MEMORY);}
<BOTH,SCRIPT>"ORIGIN" { RTOKEN(ORIGIN);}
+<BOTH,SCRIPT>"VERSION" { RTOKEN(VERSION);}
<EXPRESSION,BOTH,SCRIPT>"BLOCK" { RTOKEN(BLOCK);}
<EXPRESSION,BOTH,SCRIPT>"BIND" { RTOKEN(BIND);}
<BOTH,SCRIPT>"LENGTH" { RTOKEN(LENGTH);}
<EXPRESSION,BOTH,SCRIPT>"ALIGN" { RTOKEN(ALIGN_K);}
<EXPRESSION,BOTH,SCRIPT>"ADDR" { RTOKEN(ADDR);}
<EXPRESSION,BOTH,SCRIPT>"LOADADDR" { RTOKEN(LOADADDR);}
+<EXPRESSION,BOTH>"MAX" { RTOKEN(MAX); }
+<EXPRESSION,BOTH>"MIN" { RTOKEN(MIN); }
<BOTH,SCRIPT>"ENTRY" { RTOKEN(ENTRY);}
<EXPRESSION,BOTH,SCRIPT>"NEXT" { RTOKEN(NEXT);}
<EXPRESSION,BOTH,SCRIPT>"sizeof_headers" { RTOKEN(SIZEOF_HEADERS);}
<BOTH,SCRIPT>"SYSLIB" { RTOKEN(SYSLIB);}
<BOTH,SCRIPT>"FLOAT" { RTOKEN(FLOAT);}
<BOTH,SCRIPT>"QUAD" { RTOKEN( QUAD);}
+<BOTH,SCRIPT>"SQUAD" { RTOKEN( SQUAD);}
<BOTH,SCRIPT>"LONG" { RTOKEN( LONG);}
<BOTH,SCRIPT>"SHORT" { RTOKEN( SHORT);}
<BOTH,SCRIPT>"BYTE" { RTOKEN( BYTE);}
<BOTH,SCRIPT>"NOFLOAT" { RTOKEN(NOFLOAT);}
-<BOTH,SCRIPT>"NOCROSSREFS" { RTOKEN(NOCROSSREFS);}
+<EXPRESSION,BOTH,SCRIPT>"NOCROSSREFS" { RTOKEN(NOCROSSREFS);}
+<BOTH,SCRIPT>"OVERLAY" { RTOKEN(OVERLAY); }
<EXPRESSION,BOTH,SCRIPT>"NOLOAD" { RTOKEN(NOLOAD);}
<EXPRESSION,BOTH,SCRIPT>"DSECT" { RTOKEN(DSECT);}
<EXPRESSION,BOTH,SCRIPT>"COPY" { RTOKEN(COPY);}
<BOTH,SCRIPT,EXPRESSION>"\r" { lineno++;}
<MRI,BOTH,SCRIPT,EXPRESSION>[ \t]
+<VERS_NODE,VERS_SCRIPT>[:,;] { return *yytext; }
+
+<VERS_NODE>global { RTOKEN(GLOBAL); }
+
+<VERS_NODE>local { RTOKEN(LOCAL); }
+
+<VERS_NODE>{V_IDENTIFIER} { yylval.name = buystring (yytext);
+ return VERS_IDENTIFIER; }
+
+<VERS_SCRIPT>{V_TAG} { yylval.name = buystring (yytext);
+ return VERS_TAG; }
+
+<VERS_START>"{" { BEGIN(VERS_SCRIPT); return *yytext; }
+
+<VERS_SCRIPT>"{" { BEGIN(VERS_NODE); return *yytext; }
+<VERS_SCRIPT,VERS_NODE>"}" { BEGIN(VERS_SCRIPT); return *yytext; }
+
+<VERS_START,VERS_NODE,VERS_SCRIPT>[\n\r] { lineno++; }
+
+<VERS_START,VERS_NODE,VERS_SCRIPT>#.* { /* Eat up comments */ }
+
+<VERS_START,VERS_NODE,VERS_SCRIPT>[ \t]+ { /* Eat up whitespace */ }
+
<<EOF>> {
include_stack_ptr--;
return END;
}
-<SCRIPT,MRI>. lex_warn_invalid(" in script", yytext);
+<SCRIPT,MRI,VERS_START,VERS_SCRIPT,VERS_NODE>. lex_warn_invalid(" in script", yytext);
<EXPRESSION,DEFSYMEXP,BOTH>. lex_warn_invalid(" in expression", yytext);
%%
}
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;
{
*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");
}
}
}
|| ! bfd_set_section_alignment (abfd, relsec, 2)
|| ! bfd_set_section_size (abfd, relsec,
datasec->reloc_count * 4))
- einfo ("%F%B: can not create .rel.sdata section: %E");
+ einfo ("%F%B: can not create .rel.sdata section: %E\n");
}
/* Double check that all other data sections are empty, as is
if ((bfd_get_section_flags (abfd, sec) & SEC_CODE) == 0
&& sec != (asection *) sdatasec
&& sec->reloc_count != 0)
- einfo ("%F%X: section %s has relocs; can not use --embedded-relocs",
+ einfo ("%F%X: section %s has relocs; can not use --embedded-relocs\n",
abfd, bfd_get_section_name (abfd, sec));
}
&errmsg))
{
if (errmsg == NULL)
- einfo ("%B%X: can not create runtime reloc information: %E",
+ einfo ("%B%X: can not create runtime reloc information: %E\n",
abfd);
else
- einfo ("%X%B: can not create runtime reloc information: %s",
+ einfo ("%X%B: can not create runtime reloc information: %s\n",
abfd, errmsg);
}
}