diff --git a/util/led/extract.c b/util/led/extract.c index 48a2f16c6..d979c1982 100644 --- a/util/led/extract.c +++ b/util/led/extract.c @@ -17,6 +17,7 @@ static char rcsid[] = "$Id$"; #include "memory.h" #include "orig.h" #include "scan.h" +#include "sym.h" static get_names(); static process(); @@ -46,9 +47,6 @@ extract() skip_modul(&head); } -unsigned short NLocals = 0; /* Number of local names to be saved. */ -unsigned short NGlobals = 0; /* Number of global names. */ - /* * Walk through the nametable of this module, counting the locals that must * appear in the final output file if this module is linked. @@ -190,7 +188,6 @@ getexternal(name) h = hash(string); old = searchname(string, h); if (old == (struct outname *)0) { - NGlobals++; entername(name, h); if (ISUNDEFINED(name)) { verbose("requires %s", string, 0, 0, 0); diff --git a/util/led/led.6 b/util/led/led.6 index cabcac1a3..7f4510096 100644 --- a/util/led/led.6 +++ b/util/led/led.6 @@ -8,7 +8,6 @@ led \- link editor .SH DESCRIPTION .I Led is a link editor for object modules, -created by one of the ACK assemblers. It combines several object programs into one, resolves external references, @@ -128,6 +127,10 @@ error telling why .I led chose to link it (which unresolved reference it resolves). This option is useful in resolving 'multiply defined' problems. +.TP +.B \-d +If led was built with debugging diagnostics, then output copious amounts +of tracing explaining what it is doing. .SH FILES ~em/lib.bin/em_led .PD 0 diff --git a/util/led/main.c b/util/led/main.c index c9a3895d2..36950dbef 100644 --- a/util/led/main.c +++ b/util/led/main.c @@ -21,6 +21,7 @@ static char rcsid[] = "$Id$"; #include "defs.h" #include "memory.h" #include "orig.h" +#include "sym.h" extern bool incore; #ifndef NOSTATISTICS @@ -381,8 +382,6 @@ evaluate() change_names(); } -extern unsigned short NGlobals, NLocals; - /* * Sect_comm[N] is the number of common bytes in section N. * It is computed after pass 1. diff --git a/util/led/memory.c b/util/led/memory.c index 0c7f02043..9e51d4863 100644 --- a/util/led/memory.c +++ b/util/led/memory.c @@ -32,6 +32,7 @@ static char rcsid[] = "$Id$"; #include "debug.h" #include "memory.h" #include "object.h" +#include "sym.h" static void copy_down(struct memory* mem, ind_t dist); static void copy_up(struct memory* mem, ind_t dist); @@ -544,7 +545,6 @@ void write_bytes(void) unsigned short nsect; long offchar; register struct memory *mem; - extern unsigned short NLocals, NGlobals; extern long NLChars, NGChars; extern int flagword; extern struct outhead outhead; diff --git a/util/led/output.c b/util/led/output.c index 835627631..1f2dff6f9 100644 --- a/util/led/output.c +++ b/util/led/output.c @@ -13,6 +13,7 @@ static char rcsid[] = "$Id$"; #include #include "const.h" #include "memory.h" +#include "sym.h" static void generate_section_names(); @@ -28,7 +29,6 @@ extern int flagword; */ beginoutput() { - extern unsigned short NLocals, NGlobals; extern long NLChars, NGChars; extern char *outputname; diff --git a/util/led/relocate.c b/util/led/relocate.c index bce18e1f9..f2e9f784d 100644 --- a/util/led/relocate.c +++ b/util/led/relocate.c @@ -16,6 +16,7 @@ static char rcsid[] = "$Id$"; #include "debug.h" #include "defs.h" #include "orig.h" +#include "sym.h" #define UBYTE(x) ((x) & BYTEMASK) @@ -400,7 +401,6 @@ static putvalu(uint32_t valu, char* addr, uint16_t type) } } -extern unsigned short NLocals, NGlobals; extern struct outsect outsect[]; extern struct orig relorig[]; diff --git a/util/led/sym.c b/util/led/sym.c index 2e6def052..a2f4ec61a 100644 --- a/util/led/sym.c +++ b/util/led/sym.c @@ -18,6 +18,7 @@ static char rcsid[] = "$Id$"; #include "const.h" #include "memory.h" #include "debug.h" +#include "sym.h" /* * Symbol table types. Each hash table entry contains the offset of a symbol @@ -34,6 +35,9 @@ struct symbol { static ind_t hashtable[NHASH]; +unsigned short NLocals = 0; /* Number of local names to be saved. */ +unsigned short NGlobals = 0; /* Number of global names. */ + /* * Initialize the symbol table. All indices should be noticeably invalid. */ @@ -90,9 +94,7 @@ searchname(string, hashval) * destroyed by allocation. However, the string of which name->on_foff is the * offset can be destroyed, so we save it first. */ -entername(name, hashval) - struct outname *name; - int hashval; +void entername(struct outname* name, int hashval) { ind_t savindex; ind_t symindex; @@ -115,6 +117,7 @@ entername(name, hashval) newname->on_foff = savindex; sym->sy_next = hashtable[hashval]; hashtable[hashval] = symindex; + NGlobals++; } /* diff --git a/util/led/sym.h b/util/led/sym.h new file mode 100644 index 000000000..60004c1c3 --- /dev/null +++ b/util/led/sym.h @@ -0,0 +1,9 @@ +#ifndef SYM_H +#define SYM_H + +extern unsigned short NLocals; /* Number of local names to be saved. */ +extern unsigned short NGlobals; /* Number of global names. */ + +extern void entername(struct outname* name, int hashval); + +#endif diff --git a/util/led/write.c b/util/led/write.c index 910323e68..2eee35495 100644 --- a/util/led/write.c +++ b/util/led/write.c @@ -15,6 +15,7 @@ static char rcsid[] = "$Id$"; #include "out.h" #include "const.h" #include "memory.h" +#include "sym.h" extern struct outhead outhead; extern struct outsect outsect[]; @@ -63,7 +64,6 @@ end_write() { register struct outname *name; register int sectindex; - extern unsigned short NGlobals; extern long NGChars; assert(!incore);