diff options
-rw-r--r-- | bfd/archive.c | 73 | ||||
-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 |
13 files changed, 113 insertions, 70 deletions
diff --git a/bfd/archive.c b/bfd/archive.c index 7f40636..8875ad3 100644 --- a/bfd/archive.c +++ b/bfd/archive.c @@ -65,13 +65,13 @@ boolean _bfd_generic_mkarchive (abfd) bfd *abfd; { - abfd->tdata =(PTR) zalloc (sizeof (struct artdata)); + abfd->tdata = bfd_zalloc(abfd, sizeof (struct artdata)); if (abfd->tdata == NULL) { bfd_error = no_memory; return false; } -bfd_ardata(abfd)->cache = 0; + bfd_ardata(abfd)->cache = 0; return true; } @@ -139,8 +139,7 @@ add_bfd_to_cache (arch_bfd, filepos, new_elt) bfd *arch_bfd, *new_elt; file_ptr filepos; { - struct ar_cache *new_cache = ((struct ar_cache *) - zalloc (sizeof (struct ar_cache))); + struct ar_cache *new_cache = ((struct ar_cache *)bfd_zalloc(arch_bfd,sizeof (struct ar_cache))); if (new_cache == NULL) { bfd_error = no_memory; @@ -252,7 +251,7 @@ snarf_ar_hdr (abfd) allocsize += namelen + 1; } - allocptr = zalloc (allocsize); + allocptr = bfd_zalloc(abfd, allocsize); if (allocptr == NULL) { bfd_error = no_memory; return NULL; @@ -296,7 +295,6 @@ get_elt_at_filepos (archive, filepos) n_nfd = _bfd_create_empty_archive_element_shell (archive); if (n_nfd == NULL) { - free (new_areldata); return NULL; } n_nfd->origin = bfd_tell (archive); @@ -307,8 +305,6 @@ get_elt_at_filepos (archive, filepos) return n_nfd; /* huh? */ - free (new_areldata); - free (n_nfd); return NULL; } @@ -379,7 +375,7 @@ bfd_generic_archive_p (abfd) if (strncmp (armag, ARMAG, SARMAG)) return 0; #endif - bfd_set_ardata(abfd, (struct artdata *) zalloc (sizeof (struct artdata))); + bfd_set_ardata(abfd, (struct artdata *) bfd_zalloc(abfd,sizeof (struct artdata))); if (bfd_ardata (abfd) == NULL) { bfd_error = no_memory; @@ -389,14 +385,14 @@ bfd_generic_archive_p (abfd) bfd_ardata (abfd)->first_file_filepos = SARMAG; if (!BFD_SEND (abfd, _bfd_slurp_armap, (abfd))) { - free (bfd_ardata (abfd)); + bfd_release(abfd, bfd_ardata (abfd)); abfd->tdata = NULL; return 0; } /* armap could be left ungc'd! FIXME -- potential storage leak */ if (!BFD_SEND (abfd, _bfd_slurp_extended_name_table, (abfd))) { - free (bfd_ardata (abfd)); + bfd_release(abfd, bfd_ardata (abfd)); abfd->tdata = NULL; return 0; } @@ -428,18 +424,16 @@ bfd_slurp_bsd_armap (abfd) mapdata = snarf_ar_hdr (abfd); if (mapdata == NULL) return false; - raw_armap = (int *) zalloc (mapdata->parsed_size); + raw_armap = (int *) bfd_zalloc(abfd,mapdata->parsed_size); if (raw_armap == NULL) { bfd_error = no_memory; byebye: - free (mapdata); return false; } if (bfd_read ((PTR)raw_armap, 1, mapdata->parsed_size, abfd) != mapdata->parsed_size) { bfd_error = malformed_archive; - free (raw_armap); goto byebye; } @@ -457,7 +451,6 @@ bfd_slurp_bsd_armap (abfd) ardata->first_file_filepos = bfd_tell (abfd); /* Pad to an even boundary if you have to */ ardata->first_file_filepos += (ardata-> first_file_filepos) %2; - free (mapdata); bfd_has_map (abfd) = true; } return true; @@ -492,11 +485,11 @@ bfd_slurp_coff_armap (abfd) mapdata = snarf_ar_hdr (abfd); if (mapdata == NULL) return false; - raw_armap = (int *) zalloc (mapdata->parsed_size); + raw_armap = (int *) bfd_alloc(abfd,mapdata->parsed_size); if (raw_armap == NULL) { bfd_error = no_memory; byebye: - free (mapdata); + return false; } @@ -504,7 +497,7 @@ bfd_slurp_coff_armap (abfd) mapdata->parsed_size) { bfd_error = malformed_archive; oops: - free (raw_armap); + goto byebye; } @@ -518,7 +511,7 @@ bfd_slurp_coff_armap (abfd) unsigned int carsym_size = (nsymz * sizeof (carsym)); unsigned int ptrsize = (4 * nsymz); unsigned int i; - ardata->symdefs = (carsym *) zalloc (carsym_size + stringsize + 1); + ardata->symdefs = (carsym *) bfd_zalloc(abfd,carsym_size + stringsize + 1); if (ardata->symdefs == NULL) { bfd_error = no_memory; goto oops; @@ -544,8 +537,7 @@ bfd_slurp_coff_armap (abfd) ardata->first_file_filepos = bfd_tell (abfd); /* Pad to an even boundary if you have to */ ardata->first_file_filepos += (ardata->first_file_filepos) %2; - free (raw_armap); - free (mapdata); + bfd_has_map (abfd) = true; return true; } @@ -580,18 +572,18 @@ _bfd_slurp_extended_name_table (abfd) if (namedata == NULL) return false; - bfd_ardata (abfd)->extended_names = zalloc (namedata->parsed_size); + bfd_ardata (abfd)->extended_names = bfd_zalloc(abfd,namedata->parsed_size); if (bfd_ardata (abfd)->extended_names == NULL) { bfd_error = no_memory; byebye: - free (namedata); + return false; } if (bfd_read ((PTR)bfd_ardata (abfd)->extended_names, 1, namedata->parsed_size, abfd) != namedata->parsed_size) { bfd_error = malformed_archive; - free (bfd_ardata (abfd)->extended_names); + bfd_ardata (abfd)->extended_names = NULL; goto byebye; } @@ -609,7 +601,7 @@ _bfd_slurp_extended_name_table (abfd) bfd_ardata (abfd)->first_file_filepos += (bfd_ardata (abfd)->first_file_filepos) %2; - free (namedata); + } return true; } @@ -656,7 +648,7 @@ bfd_construct_extended_name_table (abfd, tabloc, tablen) if (total_namelen == 0) return true; - *tabloc = zalloc (total_namelen); + *tabloc = bfd_zalloc (abfd,total_namelen); if (*tabloc == NULL) { bfd_error = no_memory; return false; @@ -701,8 +693,9 @@ bfd_construct_extended_name_table (abfd, tabloc, tablen) */ struct areltdata * -bfd_ar_hdr_from_filesystem (filename) - char *filename; +DEFUN(bfd_ar_hdr_from_filesystem, (abfd,filename), + bfd* abfd AND + CONST char *filename) { struct stat status; struct areltdata *ared; @@ -715,7 +708,7 @@ bfd_ar_hdr_from_filesystem (filename) return NULL; } - ared = (struct areltdata *) zalloc (sizeof (struct ar_hdr) + + ared = (struct areltdata *) bfd_zalloc(abfd, sizeof (struct ar_hdr) + sizeof (struct areltdata)); if (ared == NULL) { bfd_error = no_memory; @@ -751,11 +744,12 @@ bfd_ar_hdr_from_filesystem (filename) } struct ar_hdr * -bfd_special_undocumented_glue (filename) - char *filename; +DEFUN(bfd_special_undocumented_glue, (abfd, filename), + bfd *abfd AND + char *filename) { - return (struct ar_hdr *) bfd_ar_hdr_from_filesystem (filename) -> arch_header; + return (struct ar_hdr *) bfd_ar_hdr_from_filesystem (abfd, filename) -> arch_header; } @@ -916,7 +910,7 @@ _bfd_write_archive_contents (arch) } if (!current->arelt_data) { current->arelt_data = - (PTR) bfd_ar_hdr_from_filesystem (current->filename); + (PTR) bfd_ar_hdr_from_filesystem (arch, current->filename); if (!current->arelt_data) return false; /* Put in the file name */ @@ -951,7 +945,6 @@ _bfd_write_archive_contents (arch) if (makemap && hasobjects) { if (compute_and_write_armap (arch, elength) != true) { - if (etable) free (etable); return false; } } @@ -968,7 +961,7 @@ _bfd_write_archive_contents (arch) bfd_write (&hdr, 1, sizeof (struct ar_hdr), arch); bfd_write (etable, 1, elength, arch); if ((elength % 2) == 1) bfd_write ("\n", 1, 1, arch); - if (etable) free (etable); + } for (current = arch->archive_head; current; current = current->next) { @@ -1018,7 +1011,7 @@ compute_and_write_armap (arch, elength) if (elength != 0) elength += sizeof (struct ar_hdr); elength += elength %2 ; - map = (struct orl *) zalloc (orl_max * sizeof (struct orl)); + map = (struct orl *) bfd_zalloc (arch,orl_max * sizeof (struct orl)); if (map == NULL) { bfd_error = no_memory; return false; @@ -1039,7 +1032,7 @@ compute_and_write_armap (arch, elength) storage = get_symtab_upper_bound (current); if (storage != 0) { - syms = (asymbol **) zalloc (storage); + syms = (asymbol **) bfd_zalloc (arch,storage); if (syms == NULL) { bfd_error = no_memory; /* FIXME -- memory leak */ return false; @@ -1057,7 +1050,7 @@ compute_and_write_armap (arch, elength) if (orl_count == orl_max) { orl_max *= 2; - map = (struct orl *) realloc ((char *) map, + map = (struct orl *) bfd_realloc (arch, (char *) map, orl_max * sizeof (struct orl)); } @@ -1075,11 +1068,11 @@ compute_and_write_armap (arch, elength) /* OK, now we have collected all the data, let's write them out */ if (!BFD_SEND (arch, write_armap, (arch, elength, map, orl_count, stridx))) { - free (map); + return false; } - free (map); + return true; } 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; } |