#include "ld.h"
#include "ldexp.h"
-#include "ldgram.tab.h"
+#include "ldgramtb.h"
#include "ldmisc.h"
#undef input
int debug;
-extern boolean ldgram_in_defsym;
+static boolean ldgram_in_defsym;
static boolean ldgram_had_equals;
extern boolean ldgram_in_script;
static char *command_line;
"BLOCK",BLOCK,
"LENGTH",LENGTH,
"ALIGN",ALIGN_K,
-"SUBSECTION_ALIGN",SUBSECTION_ALIGN,
"ADDR",ADDR,
"ENTRY",ENTRY,
-"SCRIPT", SCRIPT,
-"ENDSCRIPT", ENDSCRIPT,
"NEXT",NEXT,
+"sizeof_headers",SIZEOF_HEADERS,
+"SIZEOF_HEADERS",SIZEOF_HEADERS,
"MAP",MAP,
"SIZEOF",SIZEOF,
"TARGET",TARGET_K,
"FILL",FILL,
"STARTUP",STARTUP,
"OUTPUT_FORMAT",OUTPUT_FORMAT,
+"OUTPUT_ARCH", OUTPUT_ARCH,
"HLL",HLL,
"SYSLIB",SYSLIB,
"FLOAT",FLOAT,
ldlex_input_stack = (FILE *)NULL;
ldfile_input_filename = (char *)NULL;
/* First char after script eof is a @ so that we can tell the grammer
- that we've eft */
+ that we've left */
thischar = '@';
}
%%
-"@" { return ENDSCRIPT; }
-"\ -defsym\ " { return OPTION_defsym; }
+"@" { return '}'; }
+"\ -defsym\ " { ldgram_in_defsym = true; return OPTION_defsym; }
"\ -noinhibit_exec\ " { return OPTION_noinhibit_exec; }
+"\ -sort_common\ " { return OPTION_sort_common;}
"\ -format\ " { return OPTION_format; }
"\ -n\ " { return OPTION_n; }
"\ -r\ " { return OPTION_r; }
+"\ -i\ " { return OPTION_r; }
"\ -Ur\ " { return OPTION_Ur; }
"\ -o\ " { return OPTION_o; }
"\ -g\ " { return OPTION_g; }
"\ -u\ " { return OPTION_u; }
"\ -s\ " { return OPTION_s; }
"\ -S\ " { return OPTION_S; }
+"\ -B{FILENAME}\ " { /* Ignored */ }
"\ -l"{FILENAME} {
yylval.name = buystring(yytext+3);
return OPTION_l;
yylval.name = ".bss";
return OPTION_Texp;
}
+"\ -O"{FILENAME} {
+ yylval.name = buystring(yytext+3);
+ return OPTION_Texp;
+ }
"\ -T"{FILENAME} {
yylval.name = buystring(yytext+3);
return OPTION_Aarch;
}
-" " { if (ldgram_had_equals == true) ldgram_in_defsym = false; }
+" " {
+ if (ldgram_had_equals == true) {
+ ldgram_in_defsym = false;
+ ldgram_had_equals = false;
+ }
+ }
"<<=" { RTOKEN(LSHIFTEQ);}
">>=" { RTOKEN(RSHIFTEQ);}
"||" { RTOKEN(OROR);}
}
}
-
+ if(ldgram_in_script == true) {
+ switch (ch) {
+ case '*':
+ case '=':
+ case '+':
+ case '-':
+ case '!':
+ case '~':
+ goto quit;
+ }
+ }
+
if (isalpha(ch) || isdigit(ch) || ch == '.' || ch == '_' ||
ch == '/' || ch == '.' || ch == '+' || ch == '-' || ch =='=') {
yytext[yyleng++] = ch;