Added support for S_CRS
This commit is contained in:
parent
5c0938d05b
commit
1168708cd0
6 changed files with 50 additions and 5 deletions
|
@ -185,7 +185,8 @@ struct outrelo {
|
|||
#define S_UND 0x0000 /* undefined item */
|
||||
#define S_ABS 0x0001 /* absolute item */
|
||||
#define S_MIN 0x0002 /* first user section */
|
||||
#define S_MAX S_TYP /* last user section */
|
||||
#define S_MAX (S_TYP-1) /* last user section */
|
||||
#define S_CRS S_TYP /* reference to other namelist item */
|
||||
.fi
|
||||
.PP
|
||||
The fields of this structure have the following purpose:
|
||||
|
|
|
@ -66,11 +66,11 @@ diag(tail, format, a1, a2, a3, a4)
|
|||
|
||||
fprintf(stderr, "%s: ", progname);
|
||||
if (archname && modulname)
|
||||
fprintf(stderr, "%s(%s): ", archname, modulname);
|
||||
fprintf(stderr, "%s(%.14s): ", archname, modulname);
|
||||
else if (archname)
|
||||
fprintf(stderr, "%s: ", archname);
|
||||
else if (modulname)
|
||||
fprintf(stderr, "%s: ", modulname);
|
||||
fprintf(stderr, "%.14s: ", modulname);
|
||||
fprintf(stderr, format, a1, a2, a3, a4);
|
||||
if (tail) fprintf(stderr, " (%s)\n", tail);
|
||||
else putc('\n', stderr);
|
||||
|
|
|
@ -80,6 +80,10 @@ get_names(head)
|
|||
name.on_foff += charindex - charoff;
|
||||
}
|
||||
namerelocate(&name);
|
||||
if ((name.on_type & S_TYP) == S_CRS) {
|
||||
name.on_valu += charindex - charoff;
|
||||
name.on_valu = savechar(ALLOGCHR, (ind_t)name.on_valu);
|
||||
}
|
||||
if (name.on_type & S_EXT) {
|
||||
getexternal(&name);
|
||||
} else {
|
||||
|
@ -146,8 +150,9 @@ namerelocate(name)
|
|||
register struct outname *name;
|
||||
{
|
||||
register int type = name->on_type;
|
||||
register int sct = type & S_TYP;
|
||||
|
||||
if ((type & S_TYP) == S_UND || (type & S_TYP) == S_ABS)
|
||||
if (sct == S_UND || sct == S_ABS || sct == S_CRS)
|
||||
return;
|
||||
if (type & S_COM) {
|
||||
if ( ! (type&S_EXT) ) fatal("local commons should be handled by the assembler") ;
|
||||
|
@ -178,6 +183,9 @@ getexternal(name)
|
|||
if (old == (struct outname *)0) {
|
||||
NGlobals++;
|
||||
entername(name, h);
|
||||
if (ISUNDEFINED(name)) {
|
||||
verbose("requires %s", string, 0, 0, 0);
|
||||
}
|
||||
} else if (!ISUNDEFINED(name)) {
|
||||
if (ISUNDEFINED(old)) {
|
||||
name->on_mptr = string; /* Just for convenience. */
|
||||
|
|
|
@ -14,7 +14,9 @@ static char rcsid[] = "$Header$";
|
|||
#include "scan.h"
|
||||
|
||||
extern bool incore;
|
||||
extern ushort NLocals;
|
||||
extern int flagword;
|
||||
extern struct outname *searchname();
|
||||
|
||||
static adjust_names();
|
||||
static handle_relos();
|
||||
|
@ -62,6 +64,7 @@ adjust_names(name, head, chars)
|
|||
{
|
||||
register int cnt;
|
||||
register long charoff;
|
||||
struct outname *base = name;
|
||||
|
||||
cnt = head->oh_nname;
|
||||
charoff = OFF_CHAR(*head);
|
||||
|
@ -70,6 +73,38 @@ adjust_names(name, head, chars)
|
|||
name->on_mptr = chars + (ind_t)(name->on_foff - charoff);
|
||||
name++;
|
||||
}
|
||||
if (! incore) {
|
||||
do_crs(base, head->oh_nname);
|
||||
}
|
||||
}
|
||||
|
||||
do_crs(base, count)
|
||||
struct outname *base;
|
||||
unsigned short count;
|
||||
{
|
||||
register struct outname *name = base;
|
||||
|
||||
while (count--) {
|
||||
if ((name->on_type & S_TYP) == S_CRS) {
|
||||
char *s;
|
||||
struct outname *p;
|
||||
|
||||
s = address(ALLOGCHR, (ind_t) name->on_valu);
|
||||
p = searchname(s, hash(s));
|
||||
|
||||
if (flagword & RFLAG) {
|
||||
name->on_valu = NLocals + (p -
|
||||
(struct outname *)
|
||||
address(ALLOGLOB, (ind_t) 0));
|
||||
}
|
||||
else {
|
||||
name->on_valu = p->on_valu;
|
||||
name->on_type &= ~S_TYP;
|
||||
name->on_type |= (p->on_type & S_TYP);
|
||||
}
|
||||
}
|
||||
name++;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -563,7 +563,7 @@ addbase(name)
|
|||
register int type = name->on_type & S_TYP;
|
||||
register int sectindex = type - S_MIN;
|
||||
|
||||
if (type == S_UND || type == S_ABS)
|
||||
if (type == S_UND || type == S_ABS || type == S_CRS)
|
||||
return;
|
||||
if (name->on_type & S_COM)
|
||||
return;
|
||||
|
|
|
@ -572,6 +572,7 @@ write_bytes()
|
|||
* At the end of the global area we have put the section names.
|
||||
*/
|
||||
if (!(flagword & SFLAG)) {
|
||||
do_crs((struct outname *)mems[ALLOLOCL].mem_base, NLocals);
|
||||
namecpy((struct outname *)mems[ALLOLOCL].mem_base,
|
||||
NLocals,
|
||||
offchar
|
||||
|
|
Loading…
Reference in a new issue