static int macho64;
static MachoHdr hdr;
-static MachoLoad load[16];
+static MachoLoad *load;
static MachoSeg seg[16];
static MachoDebug xdebug[16];
-static int nload, nseg, ndebug, nsect;
+static int nload, mload, nseg, ndebug, nsect;
void
machoinit(void)
{
MachoLoad *l;
- if(nload >= nelem(load)) {
- diag("too many loads");
- errorexit();
+ if(nload >= mload) {
+ if(mload == 0)
+ mload = 1;
+ else
+ mload *= 2;
+ load = realloc(load, mload*sizeof load[0]);
+ if(load == nil) {
+ diag("out of memory");
+ errorexit();
+ }
}
-
+
if(macho64 && (ndata & 1))
ndata++;