There are two places where names are added to the global symbol table; one via
the -U command line option, and one via file scanning. Turns out only the second would increment the number of global names, so adding names with -U would cause names found via scanning to fall off the end of the list! This wouldn't cause linker errors because fixups don't use the list, but would cause the generated symbol table in the output to be incorrect.
This commit is contained in:
parent
d5a9f1541a
commit
4cb4bdc85f
|
@ -17,6 +17,7 @@ static char rcsid[] = "$Id$";
|
||||||
#include "memory.h"
|
#include "memory.h"
|
||||||
#include "orig.h"
|
#include "orig.h"
|
||||||
#include "scan.h"
|
#include "scan.h"
|
||||||
|
#include "sym.h"
|
||||||
|
|
||||||
static get_names();
|
static get_names();
|
||||||
static process();
|
static process();
|
||||||
|
@ -46,9 +47,6 @@ extract()
|
||||||
skip_modul(&head);
|
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
|
* Walk through the nametable of this module, counting the locals that must
|
||||||
* appear in the final output file if this module is linked.
|
* appear in the final output file if this module is linked.
|
||||||
|
@ -190,7 +188,6 @@ getexternal(name)
|
||||||
h = hash(string);
|
h = hash(string);
|
||||||
old = searchname(string, h);
|
old = searchname(string, h);
|
||||||
if (old == (struct outname *)0) {
|
if (old == (struct outname *)0) {
|
||||||
NGlobals++;
|
|
||||||
entername(name, h);
|
entername(name, h);
|
||||||
if (ISUNDEFINED(name)) {
|
if (ISUNDEFINED(name)) {
|
||||||
verbose("requires %s", string, 0, 0, 0);
|
verbose("requires %s", string, 0, 0, 0);
|
||||||
|
|
|
@ -8,7 +8,6 @@ led \- link editor
|
||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
.I Led
|
.I Led
|
||||||
is a link editor for object modules,
|
is a link editor for object modules,
|
||||||
created by one of the ACK assemblers.
|
|
||||||
It combines several
|
It combines several
|
||||||
object programs into one,
|
object programs into one,
|
||||||
resolves external references,
|
resolves external references,
|
||||||
|
@ -128,6 +127,10 @@ error telling why
|
||||||
.I led
|
.I led
|
||||||
chose to link it (which unresolved reference it resolves).
|
chose to link it (which unresolved reference it resolves).
|
||||||
This option is useful in resolving 'multiply defined' problems.
|
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
|
.SH FILES
|
||||||
~em/lib.bin/em_led
|
~em/lib.bin/em_led
|
||||||
.PD 0
|
.PD 0
|
||||||
|
|
|
@ -21,6 +21,7 @@ static char rcsid[] = "$Id$";
|
||||||
#include "defs.h"
|
#include "defs.h"
|
||||||
#include "memory.h"
|
#include "memory.h"
|
||||||
#include "orig.h"
|
#include "orig.h"
|
||||||
|
#include "sym.h"
|
||||||
|
|
||||||
extern bool incore;
|
extern bool incore;
|
||||||
#ifndef NOSTATISTICS
|
#ifndef NOSTATISTICS
|
||||||
|
@ -381,8 +382,6 @@ evaluate()
|
||||||
change_names();
|
change_names();
|
||||||
}
|
}
|
||||||
|
|
||||||
extern unsigned short NGlobals, NLocals;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Sect_comm[N] is the number of common bytes in section N.
|
* Sect_comm[N] is the number of common bytes in section N.
|
||||||
* It is computed after pass 1.
|
* It is computed after pass 1.
|
||||||
|
|
|
@ -32,6 +32,7 @@ static char rcsid[] = "$Id$";
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
#include "memory.h"
|
#include "memory.h"
|
||||||
#include "object.h"
|
#include "object.h"
|
||||||
|
#include "sym.h"
|
||||||
|
|
||||||
static void copy_down(struct memory* mem, ind_t dist);
|
static void copy_down(struct memory* mem, ind_t dist);
|
||||||
static void copy_up(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;
|
unsigned short nsect;
|
||||||
long offchar;
|
long offchar;
|
||||||
register struct memory *mem;
|
register struct memory *mem;
|
||||||
extern unsigned short NLocals, NGlobals;
|
|
||||||
extern long NLChars, NGChars;
|
extern long NLChars, NGChars;
|
||||||
extern int flagword;
|
extern int flagword;
|
||||||
extern struct outhead outhead;
|
extern struct outhead outhead;
|
||||||
|
|
|
@ -13,6 +13,7 @@ static char rcsid[] = "$Id$";
|
||||||
#include <out.h>
|
#include <out.h>
|
||||||
#include "const.h"
|
#include "const.h"
|
||||||
#include "memory.h"
|
#include "memory.h"
|
||||||
|
#include "sym.h"
|
||||||
|
|
||||||
static void generate_section_names();
|
static void generate_section_names();
|
||||||
|
|
||||||
|
@ -28,7 +29,6 @@ extern int flagword;
|
||||||
*/
|
*/
|
||||||
beginoutput()
|
beginoutput()
|
||||||
{
|
{
|
||||||
extern unsigned short NLocals, NGlobals;
|
|
||||||
extern long NLChars, NGChars;
|
extern long NLChars, NGChars;
|
||||||
extern char *outputname;
|
extern char *outputname;
|
||||||
|
|
||||||
|
|
|
@ -16,6 +16,7 @@ static char rcsid[] = "$Id$";
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
#include "defs.h"
|
#include "defs.h"
|
||||||
#include "orig.h"
|
#include "orig.h"
|
||||||
|
#include "sym.h"
|
||||||
|
|
||||||
#define UBYTE(x) ((x) & BYTEMASK)
|
#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 outsect outsect[];
|
||||||
extern struct orig relorig[];
|
extern struct orig relorig[];
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,7 @@ static char rcsid[] = "$Id$";
|
||||||
#include "const.h"
|
#include "const.h"
|
||||||
#include "memory.h"
|
#include "memory.h"
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
|
#include "sym.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Symbol table types. Each hash table entry contains the offset of a symbol
|
* Symbol table types. Each hash table entry contains the offset of a symbol
|
||||||
|
@ -34,6 +35,9 @@ struct symbol {
|
||||||
|
|
||||||
static ind_t hashtable[NHASH];
|
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.
|
* 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
|
* destroyed by allocation. However, the string of which name->on_foff is the
|
||||||
* offset can be destroyed, so we save it first.
|
* offset can be destroyed, so we save it first.
|
||||||
*/
|
*/
|
||||||
entername(name, hashval)
|
void entername(struct outname* name, int hashval)
|
||||||
struct outname *name;
|
|
||||||
int hashval;
|
|
||||||
{
|
{
|
||||||
ind_t savindex;
|
ind_t savindex;
|
||||||
ind_t symindex;
|
ind_t symindex;
|
||||||
|
@ -115,6 +117,7 @@ entername(name, hashval)
|
||||||
newname->on_foff = savindex;
|
newname->on_foff = savindex;
|
||||||
sym->sy_next = hashtable[hashval];
|
sym->sy_next = hashtable[hashval];
|
||||||
hashtable[hashval] = symindex;
|
hashtable[hashval] = symindex;
|
||||||
|
NGlobals++;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
9
util/led/sym.h
Normal file
9
util/led/sym.h
Normal file
|
@ -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
|
|
@ -15,6 +15,7 @@ static char rcsid[] = "$Id$";
|
||||||
#include "out.h"
|
#include "out.h"
|
||||||
#include "const.h"
|
#include "const.h"
|
||||||
#include "memory.h"
|
#include "memory.h"
|
||||||
|
#include "sym.h"
|
||||||
|
|
||||||
extern struct outhead outhead;
|
extern struct outhead outhead;
|
||||||
extern struct outsect outsect[];
|
extern struct outsect outsect[];
|
||||||
|
@ -63,7 +64,6 @@ end_write()
|
||||||
{
|
{
|
||||||
register struct outname *name;
|
register struct outname *name;
|
||||||
register int sectindex;
|
register int sectindex;
|
||||||
extern unsigned short NGlobals;
|
|
||||||
extern long NGChars;
|
extern long NGChars;
|
||||||
|
|
||||||
assert(!incore);
|
assert(!incore);
|
||||||
|
|
Loading…
Reference in a new issue