From: Mike Pall Date: Tue, 29 Dec 2009 19:13:34 +0000 (+0100) Subject: Fix PE object build on x64 and with disabled interpreter. X-Git-Tag: v2.0.0-beta3~155 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=82f7d0907cba3cef96c49bed4b4a64b228a6fd97;p=thirdparty%2FLuaJIT.git Fix PE object build on x64 and with disabled interpreter. --- diff --git a/src/buildvm_peobj.c b/src/buildvm_peobj.c index a24ae727..4b5d98c6 100644 --- a/src/buildvm_peobj.c +++ b/src/buildvm_peobj.c @@ -129,7 +129,7 @@ static void emit_peobj_sym(BuildCtx *ctx, const char *name, uint32_t value, memset(sym.n.name+len, 0, 8-len); } else { sym.n.nameref[0] = 0; - sym.n.nameref[1] = strtabofs; + sym.n.nameref[1] = (uint32_t)strtabofs; memcpy(strtab + strtabofs, name, len); strtab[strtabofs+len] = 0; strtabofs += len+1; @@ -225,6 +225,9 @@ void emit_peobj(BuildCtx *ctx) for (nzsym = 0; ctx->sym_ofs[ctx->perm[nzsym]] < 0; nzsym++) ; for (relocsyms = 0; ctx->extnames[relocsyms]; relocsyms++) ; pehdr.nsyms = 1+PEOBJ_NSECTIONS*2 + 1+(ctx->nsym-nzsym)+1 + relocsyms; +#if !LJ_HASJIT + pehdr.nsyms -= 7; +#endif /* Write PE object header and all sections. */ owrite(ctx, &pehdr, sizeof(PEheader)); @@ -306,7 +309,7 @@ void emit_peobj(BuildCtx *ctx) break; /* 2nd pass: alloc strtab, write syms and copy strings. */ strtab = (char *)malloc(strtabofs); - *(uint32_t *)strtab = strtabofs; + *(uint32_t *)strtab = (uint32_t)strtabofs; } /* Write string table. */