#define address(piece,offset) (mems[(piece)].mem_base+(offset))
#define modulptr(offset) (mems[ALLOMODL].mem_base+core_position+(offset))
+#define int_align(sz) (((sz)+(sizeof(int)-1))&~(sizeof(int)-1))
+
extern ind_t core_position;
extern ind_t hard_alloc();
extern ind_t alloc();
if (!incore)
return;
- if ((p = core_alloc(ALLOMODL, (long)sizeof(ushort))) != (char *)0) {
+ if ((p = core_alloc(ALLOMODL, (long)sizeof(int))) != (char *)0) {
*(ushort *)p = AALMAG;
- core_position += sizeof(ushort);
+ core_position += sizeof(int);
}
}
if ((p=core_alloc(ALLOMODL,(long)sizeof(struct ar_hdr)))!=(char *)0) {
*(struct ar_hdr *)p = *hdr;
- core_position += sizeof(struct ar_hdr);
+ core_position += int_align(sizeof(struct ar_hdr));
}
}
if (strcmp(archive_header.ar_name, SYMDEF))
fatal("no table of contents");
} else if (incore) {
- modulbase += sizeof(ushort);
- core_position += sizeof(ushort);
+ modulbase += sizeof(int);
+ core_position += sizeof(int);
}
return ARCHIVE;
default:
} else {
/* Copy structs. */
*archive_header = *(struct ar_hdr *)modulbase;
- modulbase += sizeof(struct ar_hdr);
- core_position += sizeof(struct ar_hdr);
+ modulbase += int_align(sizeof(struct ar_hdr));
+ core_position += int_align(sizeof(struct ar_hdr));
}
#ifdef SYMDBUG
objectsize = archive_header.ar_size;
register ind_t skip = modulsize(head);
if (incore) {
- core_position += skip;
+ core_position += int_align(skip);
if (passnumber == SECOND)
- modulbase += skip;
+ modulbase += int_align(skip);
} else {
dealloc(ALLOMODL);
core_position = (ind_t)0;