Fixed some grammer ambiguities

Better error reporting
sun3 support
This commit is contained in:
Steve Chamberlain 1991-04-03 22:03:55 +00:00
parent d008dd076c
commit 7ca04d280d
6 changed files with 135 additions and 193 deletions

View File

@ -22,16 +22,18 @@
#define EMULATION_ENVIRON "LDEMULATION"
/* If in there look for the strings: */
#define GLD_EMULATION_NAME "gld"
#define GLD68K_EMULATION_NAME "gld68k"
#define GLD960_EMULATION_NAME "gld960"
#define LNK960_EMULATION_NAME "lnk960"
/* Otherwise default to this emulation */
#define DEFAULT_EMULATION GLD960_EMULATION_NAME
#define DEFAULT_EMULATION GLD68K_EMULATION_NAME
/* Look in this variable for a target format */
#define TARGET_ENVIRON "GNUTARGET"
/* If not there then choose this */
#define GLD_TARGET "a.out-generic-big"
#define GLD68K_TARGET "a.out-generic-big"
#define LNK960_TARGET "coff-Intel-big"
#define GLD960_TARGET "b.out.big"

View File

@ -20,27 +20,6 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
/*
$Id$
$Log$
Revision 1.2 1991/03/22 23:02:28 steve
Brought up to sync with Intel again.
* Revision 1.1 1991/03/13 00:48:09 chrisb
* Initial revision
*
* Revision 1.4 1991/03/10 09:31:16 rich
* Modified Files:
* Makefile config.h ld-emul.c ld-emul.h ld-gld.c ld-gld960.c
* ld-lnk960.c ld.h lddigest.c ldexp.c ldexp.h ldfile.c ldfile.h
* ldgram.y ldinfo.h ldlang.c ldlang.h ldlex.h ldlex.l ldmain.c
* ldmain.h ldmisc.c ldmisc.h ldsym.c ldsym.h ldversion.c
* ldversion.h ldwarn.h ldwrite.c ldwrite.h y.tab.h
*
* As of this round of changes, ld now builds on all hosts of (Intel960)
* interest and copy passes my copy test on big endian hosts again.
*
* Revision 1.3 1991/02/22 17:14:55 sac
* Added RCS keywords and copyrights
*
*/
/*
@ -57,6 +36,7 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
extern ld_emulation_xfer_type ld_lnk960_emulation;
extern ld_emulation_xfer_type ld_gld_emulation;
extern ld_emulation_xfer_type ld_gld68k_emulation;
extern ld_emulation_xfer_type ld_gld960_emulation;
@ -132,6 +112,9 @@ char *target;
else if (strcmp(target,GLD_EMULATION_NAME)==0) {
ld_emulation = &ld_gld_emulation;
}
else if (strcmp(target,GLD68K_EMULATION_NAME)==0) {
ld_emulation = &ld_gld68k_emulation;
}
else if (strcmp(target,GLD960_EMULATION_NAME)==0) {
ld_emulation = &ld_gld960_emulation;
}

View File

@ -97,3 +97,31 @@ PROTO(etree_type *,exp_assop,(int, char *, etree_type *));
PROTO(void, exp_print_tree,(struct _iobuf *, etree_type *));
PROTO(bfd_vma, exp_get_vma,(etree_type *, bfd_vma, char *, enum boolean));
PROTO(int, exp_get_value_int,(etree_type *, int, char *, enum boolean));
#if 0
#define LONG 1000
#define SHORT 1001
#define BYTE 1002
#define NAME 1003
#define NEXT 1004
#define DEFINED 1005
#define SIZEOF 1006
#define ADDR 1007
#define ALIGN_K 1008
#define BLOCK 1009
#define SECTIONS 1010
#define SIZEOF_HEADERS 1011
#define MEMORY 1012
#define DSECT 1013
#define COPY 1014
#define INFO 1015
#define OVERLAY 1016
#define TARGET_K 1017
#define MAP 1018
#define ENTRY 1019
#define ORIGIN 1020
#define LENGTH 1021
#define NOLOAD 1022
#define SEARCH_DIR 1023
#define ALIGNMENT 1024
#endif

View File

@ -20,37 +20,6 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
/*
* $Id$
*
* $Log$
* Revision 1.1 1991/03/21 21:28:41 gumby
* Initial revision
*
* Revision 1.2 1991/03/16 22:27:24 rich
* fish
*
* Revision 1.1 1991/03/13 00:48:21 chrisb
* Initial revision
*
* Revision 1.6 1991/03/10 09:31:26 rich
* Modified Files:
* Makefile config.h ld-emul.c ld-emul.h ld-gld.c ld-gld960.c
* ld-lnk960.c ld.h lddigest.c ldexp.c ldexp.h ldfile.c ldfile.h
* ldgram.y ldinfo.h ldlang.c ldlang.h ldlex.h ldlex.l ldmain.c
* ldmain.h ldmisc.c ldmisc.h ldsym.c ldsym.h ldversion.c
* ldversion.h ldwarn.h ldwrite.c ldwrite.h y.tab.h
*
* As of this round of changes, ld now builds on all hosts of (Intel960)
* interest and copy passes my copy test on big endian hosts again.
*
* Revision 1.5 1991/03/09 03:25:48 sac
* Can now parse the -Ur flag
*
* Revision 1.4 1991/03/06 02:26:01 sac
* Added support for constructor sections.
* Remove parsing ambiguity.
* Lint
*
* Revision 1.3 1991/02/22 17:15:13 sac
* Added RCS keywords and copyrights
*
*/
@ -113,10 +82,11 @@ char *current_file;
boolean ldgram_want_filename = true;
boolean had_script = false;
boolean force_make_executable = false;
boolean ldgram_mustbe_filename = false;
boolean ldgram_mustbe_symbolname = false;
boolean ldgram_has_inputfile = false;
boolean ldgram_in_expression = false;
boolean ldgram_in_defsym = false;
/* LOCALS */
@ -171,7 +141,9 @@ boolean ldgram_has_inputfile = false;
%token MEMORY
%token DSECT NOLOAD COPY INFO OVERLAY
%token NAME DEFINED TARGET_K SEARCH_DIR MAP ENTRY
%token OPTION_e OPTION_c OPTION_noinhibit_exec OPTION_s OPTION_S OPTION_format
%token OPTION_e OPTION_c OPTION_noinhibit_exec OPTION_s OPTION_S
%token OPTION_format OPTION_F
%token OPTION_d OPTION_dc OPTION_dp OPTION_x OPTION_X
%token OPTION_v OPTION_M OPTION_t STARTUP HLL SYSLIB FLOAT NOFLOAT OPTION_defsym
%token OPTION_n OPTION_r OPTION_o OPTION_b OPTION_A
@ -195,14 +167,7 @@ file: command_line { lang_final(); };
filename:
{
ldgram_mustbe_filename =true;
}
NAME
{
ldgram_mustbe_filename = false;
$$ = $2;
}
NAME;
command_line:
command_line command_line_option
@ -271,23 +236,23 @@ command_line_option:
{
/* Ignored */
}
| OPTION_dp
| OPTION_dp
{
command_line.force_common_definition = true;
}
| OPTION_format NAME
{
lang_add_target($2);
}
| OPTION_format NAME
{
lang_add_target($2);
}
| OPTION_Texp { hex_mode =true; }
exp_head
| OPTION_Texp { hex_mode =true; }
exp
{ lang_section_start($1, $3);
hex_mode = false; }
| OPTION_Aarch
| OPTION_Aarch
{ ldfile_add_arch($1); }
| OPTION_b NAME
| OPTION_b NAME
{
lang_add_target($2);
}
@ -295,6 +260,11 @@ command_line_option:
{
ldfile_add_library_path($1);
}
| OPTION_F
{
/* Ignore */
}
| ifile_p1
| input_list
| OPTION_c filename
@ -317,7 +287,15 @@ command_line_option:
lang_input_file_is_symbols_only_enum,
(char *)NULL);
}
| OPTION_defsym assignment_with_nospaces
| OPTION_defsym
{
ldgram_in_defsym = true;
}
assignment
{
ldgram_in_defsym = false;
}
;
@ -468,11 +446,6 @@ assign_op:
end: ';' | ','
;
assignment_with_nospaces:
{ ldgram_want_filename = false; }
assignment
{ ldgram_want_filename = true; }
;
assignment:
@ -663,14 +636,18 @@ opt_things:
;
exp_head:
{ ldgram_mustbe_symbolname = true; }
{
ldgram_in_expression = true;
}
exp
{ ldgram_mustbe_symbolname = false;
$$ = $2;
}
{
ldgram_in_expression = false;
$$ = $2;
}
;
opt_exp:
exp
exp_head
{ $$ = $1; }
| { $$= (etree_type *)NULL; }
;

View File

@ -19,41 +19,7 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
/*
* $Id$
*
* $Log$
* Revision 1.1 1991/03/21 21:28:50 gumby
* Initial revision
*
* Revision 1.3 1991/03/16 22:27:24 rich
* fish
*
* Revision 1.2 1991/03/15 18:45:55 rich
* foo
*
* Revision 1.1 1991/03/13 00:48:27 chrisb
* Initial revision
*
* Revision 1.6 1991/03/10 09:31:32 rich
* Modified Files:
* Makefile config.h ld-emul.c ld-emul.h ld-gld.c ld-gld960.c
* ld-lnk960.c ld.h lddigest.c ldexp.c ldexp.h ldfile.c ldfile.h
* ldgram.y ldinfo.h ldlang.c ldlang.h ldlex.h ldlex.l ldmain.c
* ldmain.h ldmisc.c ldmisc.h ldsym.c ldsym.h ldversion.c
* ldversion.h ldwarn.h ldwrite.c ldwrite.h y.tab.h
*
* As of this round of changes, ld now builds on all hosts of (Intel960)
* interest and copy passes my copy test on big endian hosts again.
*
* Revision 1.5 1991/03/09 03:25:49 sac
* Can now parse the -Ur flag
*
* Revision 1.4 1991/03/06 02:26:04 sac
* Added support for constructor sections.
* Remove parsing ambiguity.
* Lint
*
* Revision 1.3 1991/02/22 17:15:14 sac
* Added RCS keywords and copyrights
*
*/
@ -79,9 +45,10 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
#define input lex_input
#define unput lex_unput
int debug;
extern boolean ldgram_want_filename;
extern boolean ldgram_mustbe_filename;
extern boolean ldgram_mustbe_symbolname;
extern boolean ldgram_in_expression;
extern boolean ldgram_in_defsym;
static char *command_line;
extern int fgetc();
@ -138,16 +105,7 @@ extern char *ldfile_input_filename;
int
lex_input()
{
/*
When we know that the next token must be a filename we force the
input routine to return a '#' character, which will cause the special
filname regexp to match the following chars even if they don't look
much like a filename to any sane person.
*/
if (ldgram_mustbe_filename) {
ldgram_mustbe_filename = false;
return '#';
}
if (have_pushback > 0)
{
@ -170,6 +128,7 @@ lex_input()
}
else thischar = 0;
if(thischar == '\t') thischar = ' ';
if (thischar == '\n') { thischar = ' '; lineno++; }
return thischar ;
}
@ -289,7 +248,6 @@ FILENAME {FILENAMECHAR}+
WHITE [ \t]+
%%
"\n" { lineno++; }
"\ -defsym" { return OPTION_defsym; }
@ -343,6 +301,13 @@ WHITE [ \t]+
return OPTION_T;
}
"\ -F"{FILENAME} {
return OPTION_F;
}
"\ -F" {
return OPTION_F;
}
"\ -A"{FILENAME} {
yylval.name = buystring(yytext+3);
return OPTION_Aarch;
@ -394,7 +359,6 @@ WHITE [ \t]+
int ch;
ch = input();
while (ch != '*') {
if (ch == '\n') {lineno++; }
ch = input();
}
@ -441,34 +405,46 @@ WHITE [ \t]+
yylval.name = buystring(p);
return NAME;
}
{FILENAMECHAR} {
{FILENAMECHAR} {
int ch;
boolean loop = false;
/*
Tokenize a name, this is really pain, since a name can be a
filename or a symbol name. filenames have slashes and stuff whist
in an expression those things are seperate tokens. We hack this by
setting lang_in_expression when we are expecting a symbol, so that
[/+-] get taken to be seperate tokens. An extra gotcha is
expressions after defsyms, we only allow +s and -s in a defsym
expression, so -defsym foo=bar+9 /file.o is parsed ok.
*/
int ch;
keyword_type *k;
if (yytext[0] == '/' && ldgram_mustbe_symbolname)
{ RTOKEN('/');}
ch = input();
while (true) {
if (isalpha(ch) || isdigit(ch) || ch == '.' || ch == '_') {
yytext[yyleng++] = ch;
if (ldgram_in_expression) {
if (yytext[0] != '/' || ldgram_in_defsym == false) {
switch (yytext[0]) {
case '/': RTOKEN('/');
case '+': RTOKEN('+');
case '-': RTOKEN('-');
}
}
else if (ch == '-' && ldgram_want_filename == true) {
yytext[yyleng++] = ch;
}
else if (ch == '+' && ldgram_want_filename == true) {
yytext[yyleng++] = ch;
}
else if (ch == '/' && ldgram_want_filename == true) {
yytext[yyleng++] = ch;
}
else break;
ch = input();
}
ch = input();
while (true)
{
if (isalpha(ch) || isdigit(ch) || ch == '.' || ch == '_') {
yytext[yyleng++] = ch;
}
else if (ch == '+' || ch == '-' || ch == '/') {
if (ldgram_in_expression) break;
yytext[yyleng++] = ch;
}
else
break;
ch = input();
}
yytext[yyleng] = 0;
unput(ch);

View File

@ -18,40 +18,6 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
/*
* $Id$
*
* $Log$
* Revision 1.2 1991/03/22 23:02:37 steve
* Brought up to sync with Intel again.
*
* Revision 1.2 1991/03/15 18:45:55 rich
* foo
*
* Revision 1.1 1991/03/13 00:48:30 chrisb
* Initial revision
*
* Revision 1.7 1991/03/10 09:31:34 rich
* Modified Files:
* Makefile config.h ld-emul.c ld-emul.h ld-gld.c ld-gld960.c
* ld-lnk960.c ld.h lddigest.c ldexp.c ldexp.h ldfile.c ldfile.h
* ldgram.y ldinfo.h ldlang.c ldlang.h ldlex.h ldlex.l ldmain.c
* ldmain.h ldmisc.c ldmisc.h ldsym.c ldsym.h ldversion.c
* ldversion.h ldwarn.h ldwrite.c ldwrite.h y.tab.h
*
* As of this round of changes, ld now builds on all hosts of (Intel960)
* interest and copy passes my copy test on big endian hosts again.
*
* Revision 1.6 1991/03/09 03:31:01 sac
* After a fatal info message, the output file is deleted.
*
* Revision 1.5 1991/03/06 21:59:54 sac
* Made %C print function name if available
*
* Revision 1.4 1991/03/06 02:27:45 sac
* Added support for linenumber printing via %C
*
* Revision 1.3 1991/02/22 17:15:03 sac
* Added RCS keywords and copyrights
*
*/
/*
@ -184,11 +150,21 @@ va_dcl
fprintf(stderr,"command line");
}
else {
fprintf(stderr,"%s:%u", ldfile_input_filename, lineno + 1);
fprintf(stderr,"%s:%u", ldfile_input_filename, lineno );
}
}
else {
fprintf(stderr,"command line ");
int ch;
int n = 0;
fprintf(stderr,"command (before <");
ch = lex_input();
while (ch != 0 && n < 10) {
fprintf(stderr, "%c", ch);
ch = lex_input();
n++;
}
fprintf(stderr,")");
}
break;
case 'C':