new object module makes buffering superfluous

This commit is contained in:
ceriel 1989-11-17 16:50:59 +00:00
parent 07cb257465
commit a46596cbba
2 changed files with 17 additions and 74 deletions

View file

@ -121,7 +121,6 @@ char **argv;
pass_23(PASS_2); pass_23(PASS_2);
#endif #endif
pass_23(PASS_3); pass_23(PASS_3);
oflush();
wr_close(); wr_close();
stop(); stop();
} }

View file

@ -197,9 +197,6 @@ short newtyp;
} }
assert(newtyp >= S_MIN); assert(newtyp >= S_MIN);
sp = &sect[newtyp - S_MIN]; sp = &sect[newtyp - S_MIN];
if (pass == PASS_3) {
wr_outsect(newtyp - S_MIN);
}
DOTVAL = sp->s_size + sp->s_base; DOTVAL = sp->s_size + sp->s_base;
DOTSCT = sp; DOTSCT = sp;
DOTTYP = newtyp; DOTTYP = newtyp;
@ -245,24 +242,11 @@ valu_t bytes;
} }
#ifdef RELOCATION #ifdef RELOCATION
static int nrelo;
static struct outrelo relobuf[100];
struct outrelo *
neworelo()
{
if (nrelo == 100) {
wr_relo(relobuf, 100);
nrelo = 0;
}
return &relobuf[nrelo++];
}
newrelo(s, n) newrelo(s, n)
short s; short s;
{ {
register struct outrelo *outrelo;
int iscomm; int iscomm;
struct outrelo outrelo;
if (rflag == 0) if (rflag == 0)
return; return;
@ -293,13 +277,12 @@ short s;
return; return;
} }
s &= ~S_VAR; s &= ~S_VAR;
outrelo = neworelo(); outrelo.or_type = (char)n;
outrelo->or_type = (char)n; outrelo.or_sect = (char)DOTTYP;
outrelo->or_sect = (char)DOTTYP;
#ifndef ASLD #ifndef ASLD
if (s == S_UND || iscomm) { if (s == S_UND || iscomm) {
assert(relonami != 0); assert(relonami != 0);
outrelo->or_nami = relonami-1; outrelo.or_nami = relonami-1;
relonami = 0; relonami = 0;
} else } else
#endif #endif
@ -308,58 +291,28 @@ short s;
/* /*
* use first non existing entry (argh) * use first non existing entry (argh)
*/ */
outrelo->or_nami = outhead.oh_nname; outrelo.or_nami = outhead.oh_nname;
} else { } else {
/* /*
* section symbols are at the end * section symbols are at the end
*/ */
outrelo->or_nami = outhead.oh_nname outrelo.or_nami = outhead.oh_nname
- outhead.oh_nsect - outhead.oh_nsect
+ (s - S_MIN) + (s - S_MIN)
; ;
} }
outrelo->or_addr = (long)DOTVAL; outrelo.or_addr = (long)DOTVAL;
wr_relo(&outrelo, 1);
} }
#endif #endif
static char sbuf[1024];
static char *psbuf = sbuf;
mwr_string(nm,len)
register char *nm;
{
register char *q = psbuf;
while (len--) {
*q++ = *nm++;
if (q == &sbuf[1024]) {
wr_string(sbuf,1024L);
q = sbuf;
}
}
psbuf = q;
}
static struct outname obuf[100];
static int nnames;
static struct outname *
newoname()
{
if (nnames == 100) {
wr_name(obuf,100);
nnames = 0;
}
return &obuf[nnames++];
}
newsymb(name, type, desc, valu) newsymb(name, type, desc, valu)
register char *name; register char *name;
short type; short type;
short desc; short desc;
valu_t valu; valu_t valu;
{ {
register struct outname *outname; struct outname outname;
if (name && *name == 0) if (name && *name == 0)
name = 0; name = 0;
@ -371,27 +324,18 @@ valu_t valu;
return; return;
} }
nname++; nname++;
outname = newoname();
if (name) { if (name) {
int len = strlen(name) + 1; long len = strlen(name) + 1;
mwr_string(name, len); wr_string(name, len);
outname->on_foff = outhead.oh_nchar; outname.on_foff = outhead.oh_nchar;
outhead.oh_nchar += len; outhead.oh_nchar += len;
} else } else
outname->on_foff = 0; outname.on_foff = 0;
outname->on_type = type; outname.on_type = type;
outname->on_desc = desc; outname.on_desc = desc;
outname->on_valu = valu & ~(((0xFFFFFFFF)<<(4*sizeof(valu_t)))<<(4*sizeof(valu_t))); outname.on_valu = valu & ~(((0xFFFFFFFF)<<(4*sizeof(valu_t)))<<(4*sizeof(valu_t)));
} wr_name(&outname, 1);
oflush()
{
#ifdef RELOCATION
if (nrelo) wr_relo(relobuf,nrelo);
#endif
if (nnames) wr_name(obuf,nnames);
if (psbuf > sbuf) wr_string(sbuf, (long) (psbuf - sbuf));
} }
new_common(ip) new_common(ip)