Author: K.S. Mullender.
#ifdef NDEBUG
-#define debug(s, a1, a2, a3, a4)
+#define debug(s, a1, a2, a3, a4) dummy()
#else
#include "const.h"
static short nerrors = 0;
+static diag();
-static
stop()
{
extern char *outputname;
{
extern char *progname, *archname, *modulname;
+extern int errno;
+fprintf(stderr, "errno = %d\n", errno);
fprintf(stderr, "%s: ", progname);
if (archname)
fprintf(stderr, "%s: ", archname);
#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.
*/
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
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;
beginoutput();
second_pass(argv);
endoutput();
- exit(0);
+ stop();
}
char *progname; /* Name this program was invoked with. */
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;
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++) {
}
closefile(file);
}
+
+#ifdef NDEBUG
+
+dummy() { ; }
+
+#endif
#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. */
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;
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");
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--)
#define INCRSIZE 1024
-typedef unsigned int ind_t;
+typedef long ind_t;
#define BADOFF ((ind_t)-1)
struct memory {
#include "const.h"
#include "memory.h"
+static generate_section_names();
+
extern struct outhead outhead;
extern bool incore;
extern int flagword;
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
#include "memory.h"
#include "orig.h"
+static openoutput();
+static wrt_head();
+static wrt_sect();
extern long lseek();
#define WRITE 1 /* Argument to open(). */