Changed to get led working under amoeba.
authorkeie <none@none>
Mon, 10 Jun 1985 10:48:49 +0000 (10:48 +0000)
committerkeie <none@none>
Mon, 10 Jun 1985 10:48:49 +0000 (10:48 +0000)
Author: K.S. Mullender.

util/led/debug.h
util/led/error.c
util/led/extract.c
util/led/finish.c
util/led/main.c
util/led/memory.c
util/led/memory.h
util/led/output.c
util/led/scan.c
util/led/write.c

index 16fff03..25ca825 100644 (file)
@@ -2,7 +2,7 @@
 
 #ifdef NDEBUG
 
-#define debug(s, a1, a2, a3, a4)
+#define debug(s, a1, a2, a3, a4)       dummy()
 
 #else
 
index 689dfd6..f5f2517 100644 (file)
@@ -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);
index 4ed5cec..dd6753b 100644 (file)
@@ -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.
  */
index 57db0aa..c259285 100644 (file)
@@ -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
index e8a3342..30cbd24 100644 (file)
@@ -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
index 8f4f527..0f41696 100644 (file)
@@ -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--)
index e78b065..b5615ef 100644 (file)
@@ -19,7 +19,7 @@
 
 #define INCRSIZE       1024
 
-typedef unsigned int   ind_t;
+typedef long           ind_t;
 #define BADOFF         ((ind_t)-1)
 
 struct memory {
index 42fc3a3..b02337c 100644 (file)
@@ -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;
index c98e51e..5edccb7 100644 (file)
@@ -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
index c73d9b6..36d8a95 100644 (file)
@@ -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(). */