%{
-/* Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000
- Free Software Foundation, Inc.
+/* Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
+ 2000, 2001, 2002 Free Software Foundation, Inc.
This file is part of GLD, the Gnu Linker.
*/
-#include <ansidecl.h>
+#include "ansidecl.h"
#include <stdio.h>
-#include <ctype.h>
#ifdef MPW
/* Prevent enum redefinition problems. */
#include "bfd.h"
#include "sysdep.h"
+#include "safe-ctype.h"
+#include "bfdlink.h"
#include "ld.h"
-#include "ldgram.h"
#include "ldmisc.h"
#include "ldexp.h"
#include "ldlang.h"
+#include <ldgram.h>
#include "ldfile.h"
#include "ldlex.h"
#include "ldmain.h"
NOCFILENAMECHAR [_a-zA-Z0-9\/\.\-\_\+\$\:\[\]\\\~]
V_TAG [.$_a-zA-Z][._a-zA-Z0-9]*
-V_IDENTIFIER [*?.$_a-zA-Z]([*?.$_a-zA-Z0-9]|::)*
+V_IDENTIFIER [*?.$_a-zA-Z\[\]\-\!\^]([*?.$_a-zA-Z0-9\[\]\-\!\^]|::)*
%s SCRIPT
%s EXPRESSION
<MRI,EXPRESSION>"$"([0-9A-Fa-f])+ {
yylval.integer = bfd_scan_vma (yytext+1, 0,16);
+ yylval.bigint.str = (char *) 0;
return INT;
}
}
yylval.integer = bfd_scan_vma (yytext, 0,
ibase);
+ yylval.bigint.str = (char *) 0;
return INT;
}
-<SCRIPT,DEFSYMEXP,MRI,BOTH,EXPRESSION>((("$"|"0x")([0-9A-Fa-f])+)|(([0-9])+))(M|K|m|k)? {
+<SCRIPT,DEFSYMEXP,MRI,BOTH,EXPRESSION>((("$"|0[xX])([0-9A-Fa-f])+)|(([0-9])+))(M|K|m|k)? {
char *s = yytext;
+ int ibase = 0;
if (*s == '$')
- ++s;
- yylval.integer = bfd_scan_vma (s, 0, 0);
+ {
+ ++s;
+ ibase = 16;
+ }
+ yylval.integer = bfd_scan_vma (s, 0, ibase);
+ yylval.bigint.str = (char *) 0;
if (yytext[yyleng-1] == 'M'
|| yytext[yyleng-1] == 'm')
- yylval.integer *= 1024 * 1024;
- if (yytext[yyleng-1] == 'K'
+ {
+ yylval.integer *= 1024 * 1024;
+ }
+ else if (yytext[yyleng-1] == 'K'
|| yytext[yyleng-1]=='k')
- yylval.integer *= 1024;
+ {
+ yylval.integer *= 1024;
+ }
+ else if (yytext[0] == '0'
+ && (yytext[1] == 'x'
+ || yytext[1] == 'X'))
+ {
+ yylval.bigint.str = xstrdup (yytext + 2);
+ }
return INT;
}
<BOTH,SCRIPT,EXPRESSION,MRI>"]" { RTOKEN(']');}
<EXPRESSION,BOTH,SCRIPT>"BIND" { RTOKEN(BIND);}
<BOTH,SCRIPT>"LENGTH" { RTOKEN(LENGTH);}
<EXPRESSION,BOTH,SCRIPT>"ALIGN" { RTOKEN(ALIGN_K);}
+<EXPRESSION,BOTH,SCRIPT>"DATA_SEGMENT_ALIGN" { RTOKEN(DATA_SEGMENT_ALIGN);}
+<EXPRESSION,BOTH,SCRIPT>"DATA_SEGMENT_END" { RTOKEN(DATA_SEGMENT_END);}
<EXPRESSION,BOTH,SCRIPT>"ADDR" { RTOKEN(ADDR);}
<EXPRESSION,BOTH,SCRIPT>"LOADADDR" { RTOKEN(LOADADDR);}
<EXPRESSION,BOTH>"MAX" { RTOKEN(MAX_K); }
<BOTH,SCRIPT>"CREATE_OBJECT_SYMBOLS" { RTOKEN(CREATE_OBJECT_SYMBOLS);}
<BOTH,SCRIPT>"CONSTRUCTORS" { RTOKEN( CONSTRUCTORS);}
<BOTH,SCRIPT>"FORCE_COMMON_ALLOCATION" { RTOKEN(FORCE_COMMON_ALLOCATION);}
+<BOTH,SCRIPT>"INHIBIT_COMMON_ALLOCATION" { RTOKEN(INHIBIT_COMMON_ALLOCATION);}
<BOTH,SCRIPT>"SECTIONS" { RTOKEN(SECTIONS);}
<BOTH,SCRIPT>"FILL" { RTOKEN(FILL);}
<BOTH,SCRIPT>"STARTUP" { RTOKEN(STARTUP);}
else
{
yy_switch_to_buffer(include_stack[include_stack_ptr]);
-
}
- BEGIN(SCRIPT);
+
ldfile_input_filename = file_name_stack[include_stack_ptr - 1];
- lineno = lineno_stack[include_stack_ptr - 1];
+ lineno = lineno_stack[include_stack_ptr];
return END;
}
einfo("%F:includes nested too deeply\n");
}
file_name_stack[include_stack_ptr] = name;
- lineno_stack[include_stack_ptr] = 1;
+ lineno_stack[include_stack_ptr] = lineno;
include_stack[include_stack_ptr] = YY_CURRENT_BUFFER;
include_stack_ptr++;
+ lineno = 1;
yyin = file;
yy_switch_to_buffer(yy_create_buffer(yyin, YY_BUF_SIZE));
- BEGIN (SCRIPT);
}
/* Return a newly created flex input buffer containing STRING,
static YY_BUFFER_STATE
yy_create_string_buffer (string, size)
- CONST char *string;
+ const char *string;
size_t size;
{
YY_BUFFER_STATE b;
void
lex_redirect (string)
- CONST char *string;
+ const char *string;
{
YY_BUFFER_STATE tmp;
einfo("%F: macros nested too deeply\n");
}
file_name_stack[include_stack_ptr] = "redirect";
- lineno_stack[include_stack_ptr] = 0;
+ lineno_stack[include_stack_ptr] = lineno;
include_stack[include_stack_ptr] = YY_CURRENT_BUFFER;
include_stack_ptr++;
+ lineno = 1;
tmp = yy_create_string_buffer (string, strlen (string));
yy_switch_to_buffer (tmp);
- BEGIN (SCRIPT);
}
\f
/* Functions to switch to a different flex start condition,
{
if (yyin)
{
- *result = read (fileno (yyin), (char *) buf, max_size);
- if (*result < 0)
+ *result = fread ((char *) buf, 1, max_size, yyin);
+ if (*result < max_size && ferror (yyin))
einfo ("%F%P: read in flex scanner failed\n");
}
}
einfo ("%F%s: file not recognized: %E\n", ldfile_input_filename);
}
- if (! isprint ((unsigned char) *what))
+ if (! ISPRINT (*what))
{
sprintf (buf, "\\%03o", (unsigned int) *what);
what = buf;