diff options
Diffstat (limited to 'contrib/binutils/ld/ldlex.l')
-rw-r--r-- | contrib/binutils/ld/ldlex.l | 40 |
1 files changed, 30 insertions, 10 deletions
diff --git a/contrib/binutils/ld/ldlex.l b/contrib/binutils/ld/ldlex.l index 5b97f13..68ed7fc 100644 --- a/contrib/binutils/ld/ldlex.l +++ b/contrib/binutils/ld/ldlex.l @@ -26,7 +26,7 @@ This was written by steve chamberlain */ -#include <ansidecl.h> +#include "ansidecl.h" #include <stdio.h> #ifdef MPW @@ -37,11 +37,12 @@ This was written by steve chamberlain #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" @@ -153,6 +154,7 @@ V_IDENTIFIER [*?.$_a-zA-Z\[\]\-\!\^]([*?.$_a-zA-Z0-9\[\]\-\!\^]|::)* <MRI,EXPRESSION>"$"([0-9A-Fa-f])+ { yylval.integer = bfd_scan_vma (yytext+1, 0,16); + yylval.bigint.str = (char *) 0; return INT; } @@ -178,20 +180,36 @@ V_IDENTIFIER [*?.$_a-zA-Z\[\]\-\!\^]([*?.$_a-zA-Z0-9\[\]\-\!\^]|::)* } 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(']');} @@ -239,6 +257,8 @@ V_IDENTIFIER [*?.$_a-zA-Z\[\]\-\!\^]([*?.$_a-zA-Z0-9\[\]\-\!\^]|::)* <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); } @@ -459,7 +479,7 @@ lex_push_file (file, name) static YY_BUFFER_STATE yy_create_string_buffer (string, size) - CONST char *string; + const char *string; size_t size; { YY_BUFFER_STATE b; @@ -501,7 +521,7 @@ yy_create_string_buffer (string, size) void lex_redirect (string) - CONST char *string; + const char *string; { YY_BUFFER_STATE tmp; |