# Definitions for the making programs.
-EM = ../..
-LIBDIR= $(EM)/lib
-PREFLAGS= -I$(EM)/h -DNDEBUG -DNASSERT
+EMHOME = ../..
+LIBDIR= $(EMHOME)/lib
+PREFLAGS= -I$(EMHOME)/h -DNDEBUG -DNASSERT
CFLAGS = $(PREFLAGS) -O
LDFLAGS = -i
-LDLIBS = $(EM)/modules/lib/libstring.a $(EM)/modules/lib/libobject.a
+LDLIBS = $(EMHOME)/modules/lib/libstring.a $(EMHOME)/modules/lib/libobject.a
LINTFLAGS=-phbxa $(PREFLAGS)
PR = pr
PRFLAGS =
$(CC) $(LDFLAGS) $(OFILES) $(LDLIBS) -o led
install:led
- rm -f $(LIBDIR)/em_led $(EM)/man/led.6 $(EM)/man/ack.out.5
+ rm -f $(LIBDIR)/em_led $(EMHOME)/man/led.6 $(EMHOME)/man/ack.out.5
cp led $(LIBDIR)/em_led
- cp led.6 $(EM)/man/led.6
- cp ack.out.5 $(EM)/man/ack.out.5
+ cp led.6 $(EMHOME)/man/led.6
+ cp ack.out.5 $(EMHOME)/man/ack.out.5
cmp: led
cmp led $(LIBDIR)/em_led
if (!ISCOMMON(new))
error("%s: multiply defined", new->on_mptr);
- if ((new->on_type & S_TYP) != (old->on_type & S_TYP))
+ else if ((new->on_type & S_TYP) != (old->on_type & S_TYP))
warning("%s: sections differ", new->on_mptr);
} else {
/* `Old' is common. */
- if ((new->on_type & S_TYP) != (old->on_type & S_TYP))
- warning("%s: sections differ", new->on_mptr);
-
if (ISCOMMON(new)) {
+ if ((new->on_type & S_TYP) != (old->on_type & S_TYP))
+ warning("%s: sections differ", new->on_mptr);
+
if (new->on_valu > old->on_valu)
old->on_valu = new->on_valu;
} else {
{
register long base = 0;
register long foff;
+ register struct outsect *sc;
register int sectindex;
foff = SZ_HEAD + outhead.oh_nsect * SZ_SECT;
for (sectindex = 0; sectindex < outhead.oh_nsect; sectindex++) {
relorig[sectindex].org_size = (long)0;
- outsect[sectindex].os_foff = foff;
- foff += outsect[sectindex].os_flen;
+ sc = &outsect[sectindex];
+ sc->os_foff = foff;
+ foff += sc->os_flen;
if ((flagword & RFLAG) && !(flagword & CFLAG))
continue;
- outsect[sectindex].os_size += sect_comm[sectindex];
+ sc->os_size += sect_comm[sectindex];
if (flagword & RFLAG) continue;
- outsect[sectindex].os_lign =
+ sc->os_lign =
tstbit(sectindex, lignmap) ? sect_lign[sectindex] : 1;
+ sc->os_size += sc->os_lign - 1;
+ sc->os_size -= sc->os_size % sc->os_lign;
if (tstbit(sectindex, basemap)) {
base = sect_base[sectindex];
- if (base % outsect[sectindex].os_lign)
+ if (base % sc->os_lign)
fatal("base not aligned");
} else {
- base += outsect[sectindex].os_lign - 1;
- base -= base % outsect[sectindex].os_lign;
+ base += sc->os_lign - 1;
+ base -= base % sc->os_lign;
}
- outsect[sectindex].os_base = base;
- base += outsect[sectindex].os_size;
+ sc->os_base = base;
+ base += sc->os_size;
}
}
struct outhead *head;
{
ind_t sectindex = IND_SECT(*head);
+ register struct outsect *sects;
ushort nsect = head->oh_nsect;
long size, rest;
extern ind_t hard_alloc();
size = modulsize(head) - sizeof(struct outhead) - rest;
if (hard_alloc(ALLOMODL, size) == BADOFF)
fatal("no space for module");
- rd_sect((struct outsect *)modulptr(sectindex), nsect);
+ rd_sect(sects = ((struct outsect *)modulptr(sectindex)), nsect);
+ while (nsect--) {
+ if (sects->os_lign > 1) {
+ sects->os_size += sects->os_lign - 1;
+ sects->os_size -= sects->os_size % sects->os_lign;
+ }
+ sects++;
+ }
return incore && alloc(ALLOMODL, rest) != BADOFF;
}
read_modul()
{
struct outhead *head;
- struct outsect *sects;
+ register struct outsect *sects;
struct outname *names;
char *chars;
ind_t sectindex, nameindex, charindex;
chars = modulptr(charindex);
rd_sect(sects, nsect);
+ while (nsect--) {
+ if (sects->os_lign > 1) {
+ sects->os_size += sects->os_lign - 1;
+ sects->os_size -= sects->os_size % sects->os_lign;
+ }
+ sects++;
+ }
rd_name(names, nname);
rd_string(chars, nchar);
}