3 /* Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
4 Free Software Foundation, Inc.
6 This file is part of GLD, the Gnu Linker.
8 GLD is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2, or (at your option)
13 GLD is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with GLD; see the file COPYING. If not, write to the Free
20 Software Foundation, 59 Temple Place - Suite 330, Boston, MA
24 This was written by steve chamberlain
33 /* Prevent enum redefinition problems. */
34 #define TRUE_FALSE_ALREADY_DEFINED
39 #include "safe-ctype.h"
48 #include "libiberty.h"
50 /* The type of top-level parser input.
51 yylex and yyparse (indirectly) both check this. */
52 input_type parser_input;
54 /* Line number in the current input file.
55 (FIXME Actually, it doesn't appear to get reset for each file?) */
56 unsigned int lineno = 1;
58 /* The string we are currently lexing, or NULL if we are reading a
60 const char *lex_string = NULL;
62 /* Support for flex reading from more than one input file (stream).
63 `include_stack' is flex's input state for each open file;
64 `file_name_stack' is the file names. `lineno_stack' is the current
67 If `include_stack_ptr' is 0, we haven't started reading anything yet.
68 Otherwise, stack elements 0 through `include_stack_ptr - 1' are valid. */
71 #define YY_INPUT(buf,result,max_size) yy_input(buf, &result, max_size)
73 #define MAX_INCLUDE_DEPTH 10
74 static YY_BUFFER_STATE include_stack[MAX_INCLUDE_DEPTH];
75 static const char *file_name_stack[MAX_INCLUDE_DEPTH];
76 static unsigned int lineno_stack[MAX_INCLUDE_DEPTH];
77 static unsigned int include_stack_ptr = 0;
78 static int vers_node_nesting = 0;
80 static YY_BUFFER_STATE yy_create_string_buffer PARAMS ((const char *string,
82 static void yy_input PARAMS ((char *, int *result, int max_size));
84 static void comment PARAMS ((void));
85 static void lex_warn_invalid PARAMS ((char *where, char *what));
88 EXPRESSION definitely in an expression
89 SCRIPT definitely in a script
90 BOTH either EXPRESSION or SCRIPT
91 DEFSYMEXP in an argument to -defsym
93 VERS_START starting a Sun style mapfile
94 VERS_SCRIPT a Sun style mapfile
95 VERS_NODE a node within a Sun style mapfile
97 #define RTOKEN(x) { yylval.token = x; return x; }
99 /* Some versions of flex want this. */
101 int yywrap () { return 1; }
108 CMDFILENAMECHAR [_a-zA-Z0-9\/\.\\_\+\$\:\[\]\\\,\=\&\!\<\>\-\~]
109 CMDFILENAMECHAR1 [_a-zA-Z0-9\/\.\\_\+\$\:\[\]\\\,\=\&\!\<\>\~]
110 FILENAMECHAR1 [_a-zA-Z\/\.\\\$\_\~]
111 SYMBOLCHARN [_a-zA-Z\/\.\\\$\_\~0-9]
112 FILENAMECHAR [_a-zA-Z0-9\/\.\-\_\+\=\$\:\[\]\\\,\~]
113 WILDCHAR [_a-zA-Z0-9\/\.\-\_\+\=\$\:\[\]\\\,\~\?\*]
116 NOCFILENAMECHAR [_a-zA-Z0-9\/\.\-\_\+\$\:\[\]\\\~]
118 V_TAG [.$_a-zA-Z][._a-zA-Z0-9]*
119 V_IDENTIFIER [*?.$_a-zA-Z]([*?.$_a-zA-Z0-9]|::)*
131 if (parser_input != input_selected)
133 /* The first token of the input determines the initial parser state. */
134 input_type t = parser_input;
135 parser_input = input_selected;
138 case input_script: return INPUT_SCRIPT; break;
139 case input_mri_script: return INPUT_MRI_SCRIPT; break;
140 case input_version_script: return INPUT_VERSION_SCRIPT; break;
141 case input_defsym: return INPUT_DEFSYM; break;
146 <BOTH,SCRIPT,EXPRESSION>"/*" { comment(); }
149 <DEFSYMEXP>"-" { RTOKEN('-');}
150 <DEFSYMEXP>"+" { RTOKEN('+');}
151 <DEFSYMEXP>{FILENAMECHAR1}{SYMBOLCHARN}* { yylval.name = xstrdup(yytext); return NAME; }
152 <DEFSYMEXP>"=" { RTOKEN('='); }
154 <MRI,EXPRESSION>"$"([0-9A-Fa-f])+ {
155 yylval.integer = bfd_scan_vma (yytext+1, 0,16);
159 <MRI,EXPRESSION>([0-9A-Fa-f])+(H|h|X|x|B|b|O|o|D|d) {
161 switch (yytext[yyleng-1]) {
179 yylval.integer = bfd_scan_vma (yytext, 0,
183 <SCRIPT,DEFSYMEXP,MRI,BOTH,EXPRESSION>((("$"|"0x")([0-9A-Fa-f])+)|(([0-9])+))(M|K|m|k)? {
188 yylval.integer = bfd_scan_vma (s, 0, 0);
189 if (yytext[yyleng-1] == 'M'
190 || yytext[yyleng-1] == 'm')
191 yylval.integer *= 1024 * 1024;
192 if (yytext[yyleng-1] == 'K'
193 || yytext[yyleng-1]=='k')
194 yylval.integer *= 1024;
197 <BOTH,SCRIPT,EXPRESSION,MRI>"]" { RTOKEN(']');}
198 <BOTH,SCRIPT,EXPRESSION,MRI>"[" { RTOKEN('[');}
199 <BOTH,SCRIPT,EXPRESSION,MRI>"<<=" { RTOKEN(LSHIFTEQ);}
200 <BOTH,SCRIPT,EXPRESSION,MRI>">>=" { RTOKEN(RSHIFTEQ);}
201 <BOTH,SCRIPT,EXPRESSION,MRI>"||" { RTOKEN(OROR);}
202 <BOTH,SCRIPT,EXPRESSION,MRI>"==" { RTOKEN(EQ);}
203 <BOTH,SCRIPT,EXPRESSION,MRI>"!=" { RTOKEN(NE);}
204 <BOTH,SCRIPT,EXPRESSION,MRI>">=" { RTOKEN(GE);}
205 <BOTH,SCRIPT,EXPRESSION,MRI>"<=" { RTOKEN(LE);}
206 <BOTH,SCRIPT,EXPRESSION,MRI>"<<" { RTOKEN(LSHIFT);}
207 <BOTH,SCRIPT,EXPRESSION,MRI>">>" { RTOKEN(RSHIFT);}
208 <BOTH,SCRIPT,EXPRESSION,MRI>"+=" { RTOKEN(PLUSEQ);}
209 <BOTH,SCRIPT,EXPRESSION,MRI>"-=" { RTOKEN(MINUSEQ);}
210 <BOTH,SCRIPT,EXPRESSION,MRI>"*=" { RTOKEN(MULTEQ);}
211 <BOTH,SCRIPT,EXPRESSION,MRI>"/=" { RTOKEN(DIVEQ);}
212 <BOTH,SCRIPT,EXPRESSION,MRI>"&=" { RTOKEN(ANDEQ);}
213 <BOTH,SCRIPT,EXPRESSION,MRI>"|=" { RTOKEN(OREQ);}
214 <BOTH,SCRIPT,EXPRESSION,MRI>"&&" { RTOKEN(ANDAND);}
215 <BOTH,SCRIPT,EXPRESSION,MRI>">" { RTOKEN('>');}
216 <BOTH,SCRIPT,EXPRESSION,MRI>"," { RTOKEN(',');}
217 <BOTH,SCRIPT,EXPRESSION,MRI>"&" { RTOKEN('&');}
218 <BOTH,SCRIPT,EXPRESSION,MRI>"|" { RTOKEN('|');}
219 <BOTH,SCRIPT,EXPRESSION,MRI>"~" { RTOKEN('~');}
220 <BOTH,SCRIPT,EXPRESSION,MRI>"!" { RTOKEN('!');}
221 <BOTH,SCRIPT,EXPRESSION,MRI>"?" { RTOKEN('?');}
222 <BOTH,SCRIPT,EXPRESSION,MRI>"*" { RTOKEN('*');}
223 <BOTH,SCRIPT,EXPRESSION,MRI>"+" { RTOKEN('+');}
224 <BOTH,SCRIPT,EXPRESSION,MRI>"-" { RTOKEN('-');}
225 <BOTH,SCRIPT,EXPRESSION,MRI>"/" { RTOKEN('/');}
226 <BOTH,SCRIPT,EXPRESSION,MRI>"%" { RTOKEN('%');}
227 <BOTH,SCRIPT,EXPRESSION,MRI>"<" { RTOKEN('<');}
228 <BOTH,SCRIPT,EXPRESSION,MRI>"=" { RTOKEN('=');}
229 <BOTH,SCRIPT,EXPRESSION,MRI>"}" { RTOKEN('}') ; }
230 <BOTH,SCRIPT,EXPRESSION,MRI>"{" { RTOKEN('{'); }
231 <BOTH,SCRIPT,EXPRESSION,MRI>")" { RTOKEN(')');}
232 <BOTH,SCRIPT,EXPRESSION,MRI>"(" { RTOKEN('(');}
233 <BOTH,SCRIPT,EXPRESSION,MRI>":" { RTOKEN(':'); }
234 <BOTH,SCRIPT,EXPRESSION,MRI>";" { RTOKEN(';');}
235 <BOTH,SCRIPT>"MEMORY" { RTOKEN(MEMORY);}
236 <BOTH,SCRIPT>"ORIGIN" { RTOKEN(ORIGIN);}
237 <BOTH,SCRIPT>"VERSION" { RTOKEN(VERSIONK);}
238 <EXPRESSION,BOTH,SCRIPT>"BLOCK" { RTOKEN(BLOCK);}
239 <EXPRESSION,BOTH,SCRIPT>"BIND" { RTOKEN(BIND);}
240 <BOTH,SCRIPT>"LENGTH" { RTOKEN(LENGTH);}
241 <EXPRESSION,BOTH,SCRIPT>"ALIGN" { RTOKEN(ALIGN_K);}
242 <EXPRESSION,BOTH,SCRIPT>"ADDR" { RTOKEN(ADDR);}
243 <EXPRESSION,BOTH,SCRIPT>"LOADADDR" { RTOKEN(LOADADDR);}
244 <EXPRESSION,BOTH>"MAX" { RTOKEN(MAX_K); }
245 <EXPRESSION,BOTH>"MIN" { RTOKEN(MIN_K); }
246 <EXPRESSION,BOTH>"ASSERT" { RTOKEN(ASSERT_K); }
247 <BOTH,SCRIPT>"ENTRY" { RTOKEN(ENTRY);}
248 <BOTH,SCRIPT,MRI>"EXTERN" { RTOKEN(EXTERN);}
249 <EXPRESSION,BOTH,SCRIPT>"NEXT" { RTOKEN(NEXT);}
250 <EXPRESSION,BOTH,SCRIPT>"sizeof_headers" { RTOKEN(SIZEOF_HEADERS);}
251 <EXPRESSION,BOTH,SCRIPT>"SIZEOF_HEADERS" { RTOKEN(SIZEOF_HEADERS);}
252 <BOTH,SCRIPT>"MAP" { RTOKEN(MAP);}
253 <EXPRESSION,BOTH,SCRIPT>"SIZEOF" { RTOKEN(SIZEOF);}
254 <BOTH,SCRIPT>"TARGET" { RTOKEN(TARGET_K);}
255 <BOTH,SCRIPT>"SEARCH_DIR" { RTOKEN(SEARCH_DIR);}
256 <BOTH,SCRIPT>"OUTPUT" { RTOKEN(OUTPUT);}
257 <BOTH,SCRIPT>"INPUT" { RTOKEN(INPUT);}
258 <EXPRESSION,BOTH,SCRIPT>"GROUP" { RTOKEN(GROUP);}
259 <EXPRESSION,BOTH,SCRIPT>"DEFINED" { RTOKEN(DEFINED);}
260 <BOTH,SCRIPT>"CREATE_OBJECT_SYMBOLS" { RTOKEN(CREATE_OBJECT_SYMBOLS);}
261 <BOTH,SCRIPT>"CONSTRUCTORS" { RTOKEN( CONSTRUCTORS);}
262 <BOTH,SCRIPT>"FORCE_COMMON_ALLOCATION" { RTOKEN(FORCE_COMMON_ALLOCATION);}
263 <BOTH,SCRIPT>"INHIBIT_COMMON_ALLOCATION" { RTOKEN(INHIBIT_COMMON_ALLOCATION);}
264 <BOTH,SCRIPT>"SECTIONS" { RTOKEN(SECTIONS);}
265 <BOTH,SCRIPT>"FILL" { RTOKEN(FILL);}
266 <BOTH,SCRIPT>"STARTUP" { RTOKEN(STARTUP);}
267 <BOTH,SCRIPT>"OUTPUT_FORMAT" { RTOKEN(OUTPUT_FORMAT);}
268 <BOTH,SCRIPT>"OUTPUT_ARCH" { RTOKEN( OUTPUT_ARCH);}
269 <BOTH,SCRIPT>"HLL" { RTOKEN(HLL);}
270 <BOTH,SCRIPT>"SYSLIB" { RTOKEN(SYSLIB);}
271 <BOTH,SCRIPT>"FLOAT" { RTOKEN(FLOAT);}
272 <BOTH,SCRIPT>"QUAD" { RTOKEN( QUAD);}
273 <BOTH,SCRIPT>"SQUAD" { RTOKEN( SQUAD);}
274 <BOTH,SCRIPT>"LONG" { RTOKEN( LONG);}
275 <BOTH,SCRIPT>"SHORT" { RTOKEN( SHORT);}
276 <BOTH,SCRIPT>"BYTE" { RTOKEN( BYTE);}
277 <BOTH,SCRIPT>"NOFLOAT" { RTOKEN(NOFLOAT);}
278 <EXPRESSION,BOTH,SCRIPT>"NOCROSSREFS" { RTOKEN(NOCROSSREFS);}
279 <BOTH,SCRIPT>"OVERLAY" { RTOKEN(OVERLAY); }
280 <BOTH,SCRIPT>"SORT" { RTOKEN(SORT); }
281 <EXPRESSION,BOTH,SCRIPT>"NOLOAD" { RTOKEN(NOLOAD);}
282 <EXPRESSION,BOTH,SCRIPT>"DSECT" { RTOKEN(DSECT);}
283 <EXPRESSION,BOTH,SCRIPT>"COPY" { RTOKEN(COPY);}
284 <EXPRESSION,BOTH,SCRIPT>"INFO" { RTOKEN(INFO);}
285 <EXPRESSION,BOTH,SCRIPT>"OVERLAY" { RTOKEN(OVERLAY);}
286 <BOTH,SCRIPT>"o" { RTOKEN(ORIGIN);}
287 <BOTH,SCRIPT>"org" { RTOKEN(ORIGIN);}
288 <BOTH,SCRIPT>"l" { RTOKEN( LENGTH);}
289 <BOTH,SCRIPT>"len" { RTOKEN( LENGTH);}
290 <BOTH,SCRIPT>"INCLUDE" { RTOKEN(INCLUDE);}
291 <BOTH,SCRIPT>"PHDRS" { RTOKEN (PHDRS); }
292 <EXPRESSION,BOTH,SCRIPT>"AT" { RTOKEN(AT);}
293 <EXPRESSION,BOTH,SCRIPT>"PROVIDE" { RTOKEN(PROVIDE); }
294 <EXPRESSION,BOTH,SCRIPT>"KEEP" { RTOKEN(KEEP); }
295 <EXPRESSION,BOTH,SCRIPT>"EXCLUDE_FILE" { RTOKEN(EXCLUDE_FILE); }
296 <MRI>"#".*\n? { ++ lineno; }
297 <MRI>"\n" { ++ lineno; RTOKEN(NEWLINE); }
298 <MRI>"*".* { /* Mri comment line */ }
299 <MRI>";".* { /* Mri comment line */ }
300 <MRI>"END" { RTOKEN(ENDWORD); }
301 <MRI>"ALIGNMOD" { RTOKEN(ALIGNMOD);}
302 <MRI>"ALIGN" { RTOKEN(ALIGN_K);}
303 <MRI>"CHIP" { RTOKEN(CHIP); }
304 <MRI>"BASE" { RTOKEN(BASE); }
305 <MRI>"ALIAS" { RTOKEN(ALIAS); }
306 <MRI>"TRUNCATE" { RTOKEN(TRUNCATE); }
307 <MRI>"LOAD" { RTOKEN(LOAD); }
308 <MRI>"PUBLIC" { RTOKEN(PUBLIC); }
309 <MRI>"ORDER" { RTOKEN(ORDER); }
310 <MRI>"NAME" { RTOKEN(NAMEWORD); }
311 <MRI>"FORMAT" { RTOKEN(FORMAT); }
312 <MRI>"CASE" { RTOKEN(CASE); }
313 <MRI>"START" { RTOKEN(START); }
314 <MRI>"LIST".* { RTOKEN(LIST); /* LIST and ignore to end of line */ }
315 <MRI>"SECT" { RTOKEN(SECT); }
316 <EXPRESSION,BOTH,SCRIPT,MRI>"ABSOLUTE" { RTOKEN(ABSOLUTE); }
317 <MRI>"end" { RTOKEN(ENDWORD); }
318 <MRI>"alignmod" { RTOKEN(ALIGNMOD);}
319 <MRI>"align" { RTOKEN(ALIGN_K);}
320 <MRI>"chip" { RTOKEN(CHIP); }
321 <MRI>"base" { RTOKEN(BASE); }
322 <MRI>"alias" { RTOKEN(ALIAS); }
323 <MRI>"truncate" { RTOKEN(TRUNCATE); }
324 <MRI>"load" { RTOKEN(LOAD); }
325 <MRI>"public" { RTOKEN(PUBLIC); }
326 <MRI>"order" { RTOKEN(ORDER); }
327 <MRI>"name" { RTOKEN(NAMEWORD); }
328 <MRI>"format" { RTOKEN(FORMAT); }
329 <MRI>"case" { RTOKEN(CASE); }
330 <MRI>"extern" { RTOKEN(EXTERN); }
331 <MRI>"start" { RTOKEN(START); }
332 <MRI>"list".* { RTOKEN(LIST); /* LIST and ignore to end of line */ }
333 <MRI>"sect" { RTOKEN(SECT); }
334 <EXPRESSION,BOTH,SCRIPT,MRI>"absolute" { RTOKEN(ABSOLUTE); }
336 <MRI>{FILENAMECHAR1}{NOCFILENAMECHAR}* {
337 /* Filename without commas, needed to parse mri stuff */
338 yylval.name = xstrdup(yytext);
343 <BOTH,EXPRESSION>{FILENAMECHAR1}{FILENAMECHAR}* {
344 yylval.name = xstrdup(yytext);
347 <BOTH,EXPRESSION>"-l"{FILENAMECHAR}+ {
348 yylval.name = xstrdup (yytext + 2);
351 <SCRIPT>{WILDCHAR}* {
352 /* Annoyingly, this pattern can match comments, and we have
353 longest match issues to consider. So if the first two
354 characters are a comment opening, put the input back and
356 if (yytext[0] == '/' && yytext[1] == '*')
363 yylval.name = xstrdup(yytext);
368 <EXPRESSION,BOTH,SCRIPT,VERS_NODE>"\""[^\"]*"\"" {
369 /* No matter the state, quotes
370 give what's inside */
371 yylval.name = xstrdup(yytext+1);
372 yylval.name[yyleng-2] = 0;
375 <BOTH,SCRIPT,EXPRESSION>"\n" { lineno++;}
376 <MRI,BOTH,SCRIPT,EXPRESSION>[ \t\r]+ { }
378 <VERS_NODE,VERS_SCRIPT>[:,;] { return *yytext; }
380 <VERS_NODE>global { RTOKEN(GLOBAL); }
382 <VERS_NODE>local { RTOKEN(LOCAL); }
384 <VERS_NODE>extern { RTOKEN(EXTERN); }
386 <VERS_NODE>{V_IDENTIFIER} { yylval.name = xstrdup (yytext);
387 return VERS_IDENTIFIER; }
389 <VERS_SCRIPT>{V_TAG} { yylval.name = xstrdup (yytext);
392 <VERS_START>"{" { BEGIN(VERS_SCRIPT); return *yytext; }
394 <VERS_SCRIPT>"{" { BEGIN(VERS_NODE);
395 vers_node_nesting = 0;
398 <VERS_SCRIPT>"}" { return *yytext; }
399 <VERS_NODE>"{" { vers_node_nesting++; return *yytext; }
400 <VERS_NODE>"}" { if (--vers_node_nesting < 0)
405 <VERS_START,VERS_NODE,VERS_SCRIPT>[\n] { lineno++; }
407 <VERS_START,VERS_NODE,VERS_SCRIPT>#.* { /* Eat up comments */ }
409 <VERS_START,VERS_NODE,VERS_SCRIPT>[ \t\r]+ { /* Eat up whitespace */ }
414 if (include_stack_ptr == 0)
420 yy_switch_to_buffer(include_stack[include_stack_ptr]);
424 ldfile_input_filename = file_name_stack[include_stack_ptr - 1];
425 lineno = lineno_stack[include_stack_ptr - 1];
430 <SCRIPT,MRI,VERS_START,VERS_SCRIPT,VERS_NODE>. lex_warn_invalid(" in script", yytext);
431 <EXPRESSION,DEFSYMEXP,BOTH>. lex_warn_invalid(" in expression", yytext);
436 /* Switch flex to reading script file NAME, open on FILE,
437 saving the current input info on the include stack. */
440 lex_push_file (file, name)
444 if (include_stack_ptr >= MAX_INCLUDE_DEPTH)
446 einfo("%F:includes nested too deeply\n");
448 file_name_stack[include_stack_ptr] = name;
449 lineno_stack[include_stack_ptr] = 1;
450 include_stack[include_stack_ptr] = YY_CURRENT_BUFFER;
454 yy_switch_to_buffer(yy_create_buffer(yyin, YY_BUF_SIZE));
458 /* Return a newly created flex input buffer containing STRING,
459 which is SIZE bytes long. */
461 static YY_BUFFER_STATE
462 yy_create_string_buffer (string, size)
468 /* Calls to m-alloc get turned by sed into xm-alloc. */
469 b = (YY_BUFFER_STATE) malloc (sizeof (struct yy_buffer_state));
470 b->yy_input_file = 0;
471 b->yy_buf_size = size;
473 /* yy_ch_buf has to be 2 characters longer than the size given because
474 we need to put in 2 end-of-buffer characters. */
475 b->yy_ch_buf = (char *) malloc ((unsigned) (b->yy_buf_size + 3));
477 b->yy_ch_buf[0] = '\n';
478 strcpy (b->yy_ch_buf+1, string);
479 b->yy_ch_buf[size+1] = YY_END_OF_BUFFER_CHAR;
480 b->yy_ch_buf[size+2] = YY_END_OF_BUFFER_CHAR;
481 b->yy_n_chars = size+1;
482 b->yy_buf_pos = &b->yy_ch_buf[1];
484 b->yy_is_our_buffer = 1;
485 b->yy_is_interactive = 0;
487 b->yy_fill_buffer = 0;
489 /* flex 2.4.7 changed the interface. FIXME: We should not be using
490 a flex internal interface in the first place! */
492 b->yy_buffer_status = YY_BUFFER_NEW;
494 b->yy_eof_status = EOF_NOT_SEEN;
500 /* Switch flex to reading from STRING, saving the current input info
501 on the include stack. */
504 lex_redirect (string)
510 if (include_stack_ptr >= MAX_INCLUDE_DEPTH)
512 einfo("%F: macros nested too deeply\n");
514 file_name_stack[include_stack_ptr] = "redirect";
515 lineno_stack[include_stack_ptr] = 0;
516 include_stack[include_stack_ptr] = YY_CURRENT_BUFFER;
518 tmp = yy_create_string_buffer (string, strlen (string));
519 yy_switch_to_buffer (tmp);
523 /* Functions to switch to a different flex start condition,
524 saving the current start condition on `state_stack'. */
526 static int state_stack[MAX_INCLUDE_DEPTH * 2];
527 static int *state_stack_p = state_stack;
532 *(state_stack_p)++ = yy_start;
539 *(state_stack_p)++ = yy_start;
544 ldlex_version_script ()
546 *(state_stack_p)++ = yy_start;
551 ldlex_version_file ()
553 *(state_stack_p)++ = yy_start;
560 *(state_stack_p)++ = yy_start;
567 *(state_stack_p)++ = yy_start;
574 *(state_stack_p)++ = yy_start;
581 yy_start = *(--state_stack_p);
585 /* Place up to MAX_SIZE characters in BUF and return in *RESULT
586 either the number of characters read, or 0 to indicate EOF. */
589 yy_input (buf, result, max_size)
595 if (yy_current_buffer->yy_input_file)
599 *result = read (fileno (yyin), (char *) buf, max_size);
601 einfo ("%F%P: read in flex scanner failed\n");
606 /* Eat the rest of a C-style comment. */
616 while (c != '*' && c != EOF)
629 break; /* found the end */
637 einfo( "%F%P: EOF in comment\n");
643 /* Warn the user about a garbage character WHAT in the input
647 lex_warn_invalid (where, what)
652 /* If we have found an input file whose format we do not recognize,
653 and we are therefore treating it as a linker script, and we find
654 an invalid character, then most likely this is a real object file
655 of some different format. Treat it as such. */
656 if (ldfile_assumed_script)
658 bfd_set_error (bfd_error_file_not_recognized);
659 einfo ("%F%s: file not recognized: %E\n", ldfile_input_filename);
662 if (! ISPRINT (*what))
664 sprintf (buf, "\\%03o", (unsigned int) *what);
668 einfo ("%P:%S: ignoring invalid character `%s'%s\n", what, where);