diff options
author | Ian Lance Taylor <ian@airs.com> | 1994-07-22 20:55:45 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@airs.com> | 1994-07-22 20:55:45 +0000 |
commit | 31ddb15694f91cf0277586a49656714d40c4b53f (patch) | |
tree | 90aaa90ac3d8a35948cb692b386897c877d18904 /ld/ldlex.l | |
parent | 7c6da9cade1c47d725fac11ddc9aaf921f85c22d (diff) | |
download | gdb-31ddb15694f91cf0277586a49656714d40c4b53f.zip gdb-31ddb15694f91cf0277586a49656714d40c4b53f.tar.gz gdb-31ddb15694f91cf0277586a49656714d40c4b53f.tar.bz2 |
* scripttempl/elf.sc: Use PROVIDE to define etext, edata, and end.
Add a new script operator, PROVIDE, to define a symbol only if it
is needed.
* ldgram.y (PROVIDE): New token.
(assignment): Accept PROVIDE.
* ldlex.l (PROVIDE): New token.
* ldexp.h (node_type): Add etree_provide to node_class enum.
(exp_provide): Declare.
* ldexp.c (exp_fold_tree): Handle etree_provide.
(exp_provide): New function.
(exp_print_tree): Handle etree_provide.
* ld.texinfo: Document PROVIDE.
Diffstat (limited to 'ld/ldlex.l')
-rw-r--r-- | ld/ldlex.l | 17 |
1 files changed, 13 insertions, 4 deletions
@@ -100,7 +100,7 @@ FILENAMECHAR1 [_a-zA-Z\/\.\\\$\_\~] SYMBOLCHARN [_a-zA-Z\/\.\\0-9] FILENAMECHAR [_a-zA-Z0-9\/\.\-\_\+\=\$\:\[\]\\\,\~] FILENAME {FILENAMECHAR}+ -WHITE [ \t\n]+ +WHITE [ \t\n\r]+ NOCFILENAMECHAR [_a-zA-Z0-9\/\.\-\_\+\$\:\[\]\\\~] @@ -117,7 +117,13 @@ NOCFILENAMECHAR [_a-zA-Z0-9\/\.\-\_\+\$\:\[\]\\\~] /* The first token of the input determines the initial parser state. */ input_type t = parser_input; parser_input = input_selected; - return t; + switch (t) + { + case input_script: return INPUT_SCRIPT; break; + case input_mri_script: return INPUT_MRI_SCRIPT; break; + case input_defsym: return INPUT_DEFSYM; break; + default: abort (); + } } <BOTH,SCRIPT,EXPRESSION>"/*" { comment(); } @@ -248,7 +254,9 @@ NOCFILENAMECHAR [_a-zA-Z0-9\/\.\-\_\+\$\:\[\]\\\~] <BOTH,SCRIPT>"len" { RTOKEN( LENGTH);} <BOTH,SCRIPT>"INCLUDE" { RTOKEN(INCLUDE);} <EXPRESSION,BOTH,SCRIPT>"AT" { RTOKEN(AT);} +<BOTH,SCRIPT>"PROVIDE" { RTOKEN(PROVIDE); } <MRI>"\n" { ++ lineno; RTOKEN(NEWLINE); } +<MRI>"\r" { ++ lineno; RTOKEN(NEWLINE); } <MRI>"*".* { /* Mri comment line */ } <MRI>"END" { RTOKEN(ENDWORD); } <MRI>"ALIGNMOD" { RTOKEN(ALIGNMOD);} @@ -299,6 +307,7 @@ NOCFILENAMECHAR [_a-zA-Z0-9\/\.\-\_\+\$\:\[\]\\\~] return NAME; } <BOTH,SCRIPT,EXPRESSION>"\n" { lineno++;} +<BOTH,SCRIPT,EXPRESSION>"\r" { lineno++;} <MRI,BOTH,SCRIPT,EXPRESSION>[ \t] <<EOF>> { @@ -479,7 +488,7 @@ comment () c = input(); while (c != '*' && c != EOF) { - if (c == '\n') + if (c == '\n' || c == '\r') lineno++; c = input(); } @@ -493,7 +502,7 @@ comment () break; /* found the end */ } - if (c == '\n') + if (c == '\n' || c == '\r') lineno++; if (c == EOF) |