diff options
author | Steve Chamberlain <steve@cygnus> | 1991-04-23 15:59:24 +0000 |
---|---|---|
committer | Steve Chamberlain <steve@cygnus> | 1991-04-23 15:59:24 +0000 |
commit | a37cc0c05c5ee0e72a14a09c547555621371ef1d (patch) | |
tree | 2df4ce4a562ee651f2f17351d0a0402c75152583 /ld | |
parent | 1327fb29568debb17b167a405a548f641bcfda69 (diff) | |
download | gdb-a37cc0c05c5ee0e72a14a09c547555621371ef1d.zip gdb-a37cc0c05c5ee0e72a14a09c547555621371ef1d.tar.gz gdb-a37cc0c05c5ee0e72a14a09c547555621371ef1d.tar.bz2 |
*** empty log message ***
Diffstat (limited to 'ld')
-rw-r--r-- | ld/Makefile.in | 11 | ||||
-rw-r--r-- | ld/config.h | 3 | ||||
-rwxr-xr-x | ld/ld-emul.c | 4 | ||||
-rwxr-xr-x | ld/ld-gld.c | 4 | ||||
-rwxr-xr-x | ld/ld-gld.script | 3 | ||||
-rw-r--r-- | ld/ldexp.c | 2 | ||||
-rw-r--r-- | ld/ldfile.c | 17 | ||||
-rw-r--r-- | ld/ldgram.y | 20 | ||||
-rw-r--r-- | ld/ldlang.c | 2 | ||||
-rw-r--r-- | ld/ldlang.h | 2 | ||||
-rw-r--r-- | ld/ldlex.l | 31 | ||||
-rw-r--r-- | ld/mkscript.c | 11 |
12 files changed, 80 insertions, 30 deletions
diff --git a/ld/Makefile.in b/ld/Makefile.in index 34c5ae9..e900348 100644 --- a/ld/Makefile.in +++ b/ld/Makefile.in @@ -25,15 +25,17 @@ DEBUG = -g SCRIPTS = ld-gld68k.script ld-gld68k-Ur.script ld-gld68k-r.script \ ld-gld.script ld-gld-Ur.script ld-gld-r.script ld-lnk960.script \ - ld-lnk960-r.script ld-gld960.script + ld-lnk960-r.script ld-gld960.script \ + ld-gldm88kbcs.script ld-gldm88kbcs-Ur.script ld-gldm88kbcs-r.script PROCESSED_SCRIPTS = ld-gld68k.x ld-gld68k-Ur.x ld-gld68k-r.x ld-gld.x \ - ld-gld-Ur.x ld-gld-r.x ld-lnk960.x ld-lnk960-r.x ld-gld960.x + ld-gld-Ur.x ld-gld-r.x ld-lnk960.x ld-lnk960-r.x ld-gld960.x \ + ld-gldm88kbcs.x ld-gldm88kbcs-Ur.x ld-gldm88kbcs-r.x #### target and host dependent Makefile fragments come in here. ### -CFLAGS = $(INCLUDES) $(DEBUG) $(HDEFINES) $(TDEFINES) +CFLAGS = $(INCLUDES) $(DEBUG) $(HDEFINES) $(TDEFINES) $(CDEFINES) LINTFLAGS = $(INCLUDES) $(EXTRA_DEF) .SUFFIXES: .y .x .script $(SUFFIXES) @@ -58,6 +60,7 @@ LDEMULATION=gld BFDLIB=$(srcdir)/../bfd$(subdir)/libbfd.a OFILES= ldgram.o ldlex.o ldlang.o ldmain.o ldwrite.o ldexp.o ld-lnk960.o ld-gld68k.o \ + ld-gldm88kbcs.o \ ld-gld.o ld-gld960.o ld-emul.o ldversion.o ldmisc.o ldsym.o ld-vanilla.o ldfile.o HEADERS=config.h ldmain.h ldmain.h ldmisc.h ldsym.h ldlang.h ldexp.h \ @@ -66,6 +69,7 @@ HEADERS=config.h ldmain.h ldmain.h ldmisc.h ldsym.h ldlang.h ldexp.h \ MANSOURCES=ld.tex LDCSOURCES=ldlang.c ldmain.c ldwrite.c ld-lnk960.c ld-gld.c ld-gld68k.c \ + ld-gldm88kbcs.c \ ld-gld960.c ld-emul.c ldversion.c ldmisc.c ldexp.c ldsym.c ldfile.c ld-vanilla.c GENERATED_SOURCES=ldgram.tab.c ldlex.c ldgram.tab.h y.tab.h @@ -128,6 +132,7 @@ ldlang.o: ldlang.c ldgram.tab.h ld-gld68k.o: $(PROCESSED_SCRIPTS) ld-gld68k.c ld-gld960.o: $(PROCESSED_SCRIPTS) ld-gld960.c +ld-gldm88kbcs.o: $(PROCESSED_SCRIPTS) ld-gldm88kbcs.c ld-emul.o: ld-emul.c ld-vanilla.o: ld-vanilla.c ld-lnk960.o: $(PROCESSED_SCRIPTS) ld-lnk960.c diff --git a/ld/config.h b/ld/config.h index abb92b4..995b2ce 100644 --- a/ld/config.h +++ b/ld/config.h @@ -23,6 +23,7 @@ /* If in there look for the strings: */ #define GLD_EMULATION_NAME "gld" #define VANILLA_EMULATION_NAME "vanilla" +#define GLDM88KBCS_EMULATION_NAME "gldm88kbcs" #define GLD68K_EMULATION_NAME "gld68k" #define GLD960_EMULATION_NAME "gld960" #define LNK960_EMULATION_NAME "lnk960" @@ -43,7 +44,7 @@ #define LNK960_TARGET "coff-Intel-big" #define GLD960_TARGET "b.out.big" #define VANILLA_TARGET "a.out-generic-big" - +#define GLDM88KBCS_TARGET "m88kbcs" diff --git a/ld/ld-emul.c b/ld/ld-emul.c index 82ebc42..ce99ce7 100755 --- a/ld/ld-emul.c +++ b/ld/ld-emul.c @@ -33,6 +33,7 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "ldmisc.h" extern ld_emulation_xfer_type ld_lnk960_emulation; +extern ld_emulation_xfer_type ld_gldm88kbcs_emulation; extern ld_emulation_xfer_type ld_gld_emulation; extern ld_emulation_xfer_type ld_vanilla_emulation; extern ld_emulation_xfer_type ld_gld68k_emulation; @@ -111,6 +112,9 @@ char *target; else if (strcmp(target,GLD960_EMULATION_NAME)==0) { ld_emulation = &ld_gld960_emulation; } +else if (strcmp(target,GLDM88KBCS_EMULATION_NAME)==0) { + ld_emulation = &ld_gldm88kbcs_emulation; +} #ifndef GNU960 else if (strcmp(target,GLD_EMULATION_NAME)==0) { ld_emulation = &ld_gld_emulation; diff --git a/ld/ld-gld.c b/ld/ld-gld.c index 7607462..018d8d1 100755 --- a/ld/ld-gld.c +++ b/ld/ld-gld.c @@ -54,7 +54,6 @@ static void gld_before_parse() ldfile_add_library_path("/lib"); ldfile_add_library_path("/usr/lib"); ldfile_add_library_path("/usr/local/lib/lib"); - ldfile_output_architecture = bfd_arch_sparc; } @@ -81,8 +80,7 @@ static void gld_set_output_arch() { /* Set the output architecture and machine if possible */ - unsigned long machine = 0; - bfd_set_arch_mach(output_bfd, ldfile_output_architecture, machine); + bfd_set_arch_mach(output_bfd, ldfile_output_architecture, ldfile_output_machine); } static char * diff --git a/ld/ld-gld.script b/ld/ld-gld.script index 8c08f78..28925de 100755 --- a/ld/ld-gld.script +++ b/ld/ld-gld.script @@ -1,4 +1,5 @@ - +OUTPUT_ARCH(sparc) +OUTPUT_FORMAT("a.out-generic-big") SEARCH_DIR(/lib) SEARCH_DIR(/usr/lib) SEARCH_DIR(/usr/local/lib) @@ -326,7 +326,7 @@ bfd_vma dot; sdef->section->vma : 0)); } else { - result = new_rel(sdef->value, os); + result = new_rel(sdef->value + sdef->section->output_offset, os); } } } diff --git a/ld/ldfile.c b/ld/ldfile.c index a52cfb0..f1c0bdb 100644 --- a/ld/ldfile.c +++ b/ld/ldfile.c @@ -333,3 +333,20 @@ DEFUN(ldfile_add_arch,(in_name), } #endif + +/* Set the output architecture */ +void +DEFUN(ldfile_set_output_arch,(string), +CONST char *string) +{ + enum bfd_architecture arch; + unsigned long machine; + if (bfd_scan_arch_mach(string, &arch, &machine) == true) { + ldfile_output_architecture = arch; + ldfile_output_machine = machine; + ldfile_output_machine_name = string; + } + else { + info("%P%F: Can't represent machine `%s'\n", string); + } +} diff --git a/ld/ldgram.y b/ld/ldgram.y index c3578b5..8bde4e4 100644 --- a/ld/ldgram.y +++ b/ld/ldgram.y @@ -62,7 +62,6 @@ boolean had_script = false; boolean force_make_executable = false; boolean ldgram_in_script = false; -boolean ldgram_in_defsym = false; boolean ldgram_had_equals = false; /* LOCALS */ @@ -96,7 +95,7 @@ boolean ldgram_had_equals = false; %token <name> NAME %type <integer> length -%right <token> PLUSEQ MINUSEQ MULTEQ DIVEQ '=' LSHIFTEQ RSHIFTEQ ANDEQ OREQ +%right <token> PLUSEQ MINUSEQ MULTEQ DIVEQ '=' LSHIFTEQ RSHIFTEQ ANDEQ OREQ %right <token> '?' ':' %left <token> OROR %left <token> ANDAND @@ -113,7 +112,7 @@ boolean ldgram_had_equals = false; %token <token> ALIGN_K BLOCK LONG SHORT BYTE %token SECTIONS %token '{' '}' -%token ALIGNMENT SIZEOF_HEADERS OUTPUT_FORMAT FORCE_COMMON_ALLOCATION +%token ALIGNMENT SIZEOF_HEADERS OUTPUT_FORMAT FORCE_COMMON_ALLOCATION OUTPUT_ARCH %token NEXT SIZEOF ADDR SCRIPT ENDSCRIPT %token MEMORY %token DSECT NOLOAD COPY INFO OVERLAY @@ -121,8 +120,8 @@ boolean ldgram_had_equals = false; %token OPTION_e OPTION_c OPTION_noinhibit_exec OPTION_s OPTION_S %token OPTION_format OPTION_F OPTION_u -%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_d OPTION_dc OPTION_dp OPTION_x OPTION_X OPTION_defsym +%token OPTION_v OPTION_M OPTION_t STARTUP HLL SYSLIB FLOAT NOFLOAT %token OPTION_n OPTION_r OPTION_o OPTION_b OPTION_A OPTION_R %token <name> OPTION_l OPTION_L OPTION_T OPTION_Aarch OPTION_Tfile OPTION_Texp %token OPTION_Ur @@ -152,11 +151,11 @@ command_line: ; command_line_option: - SCRIPT + '{' { ldgram_in_script = true; } ifile_list { ldgram_in_script = false; } - ENDSCRIPT + '}' | OPTION_v { ldversion(); @@ -280,14 +279,11 @@ command_line_option: } | OPTION_defsym { - ldgram_in_defsym = true; - ldgram_had_equals = false; } NAME '=' exp_head { lang_add_assignment(exp_assop($4,$3,$5)); - ldgram_in_defsym = false; } | '-' NAME { info("%P%F Unrecognised option -%s\n", $2); } @@ -303,7 +299,7 @@ command_line_option: script_file: { ldgram_in_script = true; } - ifile_list ENDSCRIPT + ifile_list '}' { ldgram_in_script = false; } ; @@ -332,6 +328,8 @@ ifile_p1: { lang_add_output($3); } | OUTPUT_FORMAT '(' NAME ')' { lang_add_output_format($3); } + | OUTPUT_ARCH '(' NAME ')' + { ldfile_set_output_arch($3); } | FORCE_COMMON_ALLOCATION { command_line.force_common_definition = true ; } | INPUT '(' input_list ')' diff --git a/ld/ldlang.c b/ld/ldlang.c index 4c57f2b..b124ac7 100644 --- a/ld/ldlang.c +++ b/ld/ldlang.c @@ -1015,6 +1015,7 @@ DEFUN(print_input_section,(in), else { printf("%s", abfd->filename); } + printf("(%d bytes)", bfd_alloc_size(abfd)); print_nl(); /* Find all the symbols in this file defined in this section */ @@ -2237,3 +2238,4 @@ CONST char *format) { output_target = format; } + diff --git a/ld/ldlang.h b/ld/ldlang.h index 5d8f525..ff1c5b1 100644 --- a/ld/ldlang.h +++ b/ld/ldlang.h @@ -341,4 +341,4 @@ PROTO(lang_output_section_statement_type *, lang_output_section_statement_lookup,(CONST char * CONST name)); PROTO(void, ldlang_add_undef,(CONST char *CONST name)); - +PROTO(void, lang_add_output_format,(CONST char *)); @@ -47,7 +47,7 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ 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; @@ -87,6 +87,7 @@ keyword_type keywords[] = "FILL",FILL, "STARTUP",STARTUP, "OUTPUT_FORMAT",OUTPUT_FORMAT, +"OUTPUT_ARCH", OUTPUT_ARCH, "HLL",HLL, "SYSLIB",SYSLIB, "FLOAT",FLOAT, @@ -125,7 +126,7 @@ lex_input() 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 = '@'; } @@ -269,12 +270,13 @@ WHITE [ \t]+ %% -"@" { return ENDSCRIPT; } -"\ -defsym\ " { return OPTION_defsym; } +"@" { return '}'; } +"\ -defsym\ " { ldgram_in_defsym = true; return OPTION_defsym; } "\ -noinhibit_exec\ " { return OPTION_noinhibit_exec; } "\ -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; } @@ -293,6 +295,7 @@ WHITE [ \t]+ "\ -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; @@ -335,7 +338,12 @@ WHITE [ \t]+ 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);} @@ -471,7 +479,18 @@ WHITE [ \t]+ } } - + 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; diff --git a/ld/mkscript.c b/ld/mkscript.c index 5edda63..59a8e87 100644 --- a/ld/mkscript.c +++ b/ld/mkscript.c @@ -6,15 +6,20 @@ main() int ch; ch = getchar(); printf("/* Generated through mkscript */\n"); - printf("\"SCRIPT \\\n"); + printf("\"{ \\\n"); while (ch != EOF) { - if (ch == '\n') { + if (ch == '\"') { + putchar('\\'); + putchar('\"'); + } +else { if (ch == '\n') { putchar(' '); putchar('\\'); } putchar(ch); + } ch = getchar(); } - printf("ENDSCRIPT\"\n"); + printf("}\"\n"); return 0; } |