From: ceriel Date: Mon, 30 Jul 1990 11:56:28 +0000 (+0000) Subject: Added support for S_CRS X-Git-Tag: release-5-5~1629 X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=1168708cd0cef5ef53d8d56447811142407f76ec;p=ack.git Added support for S_CRS --- diff --git a/util/led/ack.out.5 b/util/led/ack.out.5 index 5e416153f..84521c7d1 100644 --- a/util/led/ack.out.5 +++ b/util/led/ack.out.5 @@ -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: diff --git a/util/led/error.c b/util/led/error.c index 3aa38c88c..96e5421a4 100644 --- a/util/led/error.c +++ b/util/led/error.c @@ -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); diff --git a/util/led/extract.c b/util/led/extract.c index 59f8d3f3f..1e09efbe2 100644 --- a/util/led/extract.c +++ b/util/led/extract.c @@ -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. */ diff --git a/util/led/finish.c b/util/led/finish.c index a34b1b54f..82bd19307 100644 --- a/util/led/finish.c +++ b/util/led/finish.c @@ -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++; + } } /* diff --git a/util/led/main.c b/util/led/main.c index d64dad7d1..f7ae4cc6c 100644 --- a/util/led/main.c +++ b/util/led/main.c @@ -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; diff --git a/util/led/memory.c b/util/led/memory.c index df5c2c2a3..065f86675 100644 --- a/util/led/memory.c +++ b/util/led/memory.c @@ -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