From: keie Date: Mon, 10 Jun 1985 10:48:49 +0000 (+0000) Subject: Changed to get led working under amoeba. X-Git-Tag: release-5-5~5449 X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=44ccf469d9798b47440c89d08c2d1fb10c6ed472;p=ack.git Changed to get led working under amoeba. Author: K.S. Mullender. --- diff --git a/util/led/debug.h b/util/led/debug.h index 16fff039a..25ca825a2 100644 --- a/util/led/debug.h +++ b/util/led/debug.h @@ -2,7 +2,7 @@ #ifdef NDEBUG -#define debug(s, a1, a2, a3, a4) +#define debug(s, a1, a2, a3, a4) dummy() #else diff --git a/util/led/error.c b/util/led/error.c index 689dfd6e0..f5f2517c0 100644 --- a/util/led/error.c +++ b/util/led/error.c @@ -8,8 +8,8 @@ static char rcsid[] = "$Header$"; #include "const.h" static short nerrors = 0; +static diag(); -static stop() { extern char *outputname; @@ -61,6 +61,8 @@ diag(tail, format, a1, a2, a3, a4) { extern char *progname, *archname, *modulname; +extern int errno; +fprintf(stderr, "errno = %d\n", errno); fprintf(stderr, "%s: ", progname); if (archname) fprintf(stderr, "%s: ", archname); diff --git a/util/led/extract.c b/util/led/extract.c index 4ed5cec55..dd6753ba1 100644 --- a/util/led/extract.c +++ b/util/led/extract.c @@ -10,6 +10,12 @@ static char rcsid[] = "$Header$"; #include "orig.h" #include "scan.h" +static get_name(); +static process(); +static getexternal(); +static redefine(); +static transfer(); + /* * Get section sizes and symboltable information from present module. */ diff --git a/util/led/finish.c b/util/led/finish.c index 57db0aa2d..c25928590 100644 --- a/util/led/finish.c +++ b/util/led/finish.c @@ -12,6 +12,11 @@ static char rcsid[] = "$Header$"; extern bool incore; extern int flagword; +static adjust_names(); +static handle_relos(); +static put_locals(); +static compute_origins(); + /* * We know all there is to know about the current module. * Now we relocate the values in the emitted bytes and write diff --git a/util/led/main.c b/util/led/main.c index e8a334207..30cbd246f 100644 --- a/util/led/main.c +++ b/util/led/main.c @@ -16,6 +16,21 @@ static char rcsid[] = "$Header$"; extern bool incore; +static initializations(); +static first_pass(); +static long number(); +static setlign(); +static setbase(); +static struct outname *makename(); +static pass1(); +static evaluate(); +static norm_commons(); +static complete_sections(); +static change_names(); +static bool tstbit(); +static second_pass(); +static pass2(); + main(argc, argv) int argc; char **argv; @@ -27,7 +42,7 @@ main(argc, argv) beginoutput(); second_pass(argv); endoutput(); - exit(0); + stop(); } char *progname; /* Name this program was invoked with. */ @@ -75,11 +90,9 @@ first_pass(argv) int sectno; int h; extern int atoi(); - extern long number(); extern char *index(); extern int hash(); extern struct outname *searchname(); - extern struct outname *makename(); while (*++argv) { argp = *argv; @@ -382,7 +395,6 @@ complete_sections() register long base = 0; register long foff; register int sectindex; - extern bool tstbit(); foff = SZ_HEAD + outhead.oh_nsect * SZ_SECT; for (sectindex = 0; sectindex < outhead.oh_nsect; sectindex++) { @@ -552,3 +564,9 @@ pass2(file) } closefile(file); } + +#ifdef NDEBUG + +dummy() { ; } + +#endif diff --git a/util/led/memory.c b/util/led/memory.c index 8f4f527d6..0f41696b2 100644 --- a/util/led/memory.c +++ b/util/led/memory.c @@ -15,6 +15,14 @@ static char rcsid[] = "$Header$"; #include "debug.h" #include "memory.h" +static copy_down(); +static copy_up(); +static free_saved_moduls(); +static writelong(); +static sectswap(); +static reloswap(); +static namecpy(); + struct memory mems[NMEMS]; bool incore = TRUE; /* TRUE while everything can be kept in core. */ @@ -32,11 +40,13 @@ init_core() register ind_t total_size; register struct memory *mem; extern char *sbrk(); + extern char *brk(); +char *BASE; #include "mach.c" total_size = (ind_t)0; /* Will accumulate the sizes. */ - base = sbrk(0); /* First free. */ + BASE = base = sbrk(0); /* First free. */ for (mem = mems; mem < &mems[NMEMS]; mem++) { mem->mem_base = base; mem->mem_full = (ind_t)0; @@ -59,7 +69,7 @@ init_core() mems[ALLOLCHR].mem_full = 1; mems[ALLOGCHR].mem_full = 1; - if (total_size != (int)total_size || (int)sbrk((int)total_size) == -1) { + if (brk(BASE + total_size) == (char *) -1) { incore = FALSE; /* In core strategy failed. */ if ((int)sbrk(AT_LEAST) == -1) fatal("no core at all"); @@ -80,7 +90,7 @@ move_up(piece, incr) extern char *sbrk(); debug("move_up(%d, %d)\n", piece, (int)incr, 0, 0); - if (incr != (int)incr || (int)sbrk((int)incr) == -1) + if (incr != (int)incr || sbrk((int)incr) == (char *) -1) return FALSE; for (mem = &mems[NMEMS - 1]; mem > &mems[piece]; mem--) diff --git a/util/led/memory.h b/util/led/memory.h index e78b065d3..b5615ef81 100644 --- a/util/led/memory.h +++ b/util/led/memory.h @@ -19,7 +19,7 @@ #define INCRSIZE 1024 -typedef unsigned int ind_t; +typedef long ind_t; #define BADOFF ((ind_t)-1) struct memory { diff --git a/util/led/output.c b/util/led/output.c index 42fc3a376..b02337c3f 100644 --- a/util/led/output.c +++ b/util/led/output.c @@ -6,6 +6,8 @@ static char rcsid[] = "$Header$"; #include "const.h" #include "memory.h" +static generate_section_names(); + extern struct outhead outhead; extern bool incore; extern int flagword; diff --git a/util/led/scan.c b/util/led/scan.c index c98e51e93..5edccb753 100644 --- a/util/led/scan.c +++ b/util/led/scan.c @@ -37,6 +37,17 @@ long objectsize; static long align(); static char *modulbase; static long modulsize(); +static scan_modul(); +static bool all_alloc(); +static bool direct_alloc(); +static bool indirect_alloc(); +static bool putemitindex(); +static bool putreloindex(); +#ifdef SYMDBUG +static bool putdbugindex(); +#endif SYMDBUG +static get_indirect(); +static read_modul(); /* * Open the file with name `filename' (if necessary) and examine the first diff --git a/util/led/write.c b/util/led/write.c index c73d9b66b..36d8a95d3 100644 --- a/util/led/write.c +++ b/util/led/write.c @@ -17,6 +17,9 @@ static char rcsid[] = "$Header$"; #include "memory.h" #include "orig.h" +static openoutput(); +static wrt_head(); +static wrt_sect(); extern long lseek(); #define WRITE 1 /* Argument to open(). */