diff options
| author | Mike Pall <mike> | 2009-12-29 20:13:34 +0100 |
|---|---|---|
| committer | Mike Pall <mike> | 2009-12-29 20:13:34 +0100 |
| commit | 82f7d0907cba3cef96c49bed4b4a64b228a6fd97 (patch) | |
| tree | 94c613b9bf5c16d6cf6dbffac54fd95ea76a234a | |
| parent | 42124227cf8c490f113c6e4b5253970f17864a79 (diff) | |
| download | luajit-82f7d0907cba3cef96c49bed4b4a64b228a6fd97.tar.gz luajit-82f7d0907cba3cef96c49bed4b4a64b228a6fd97.tar.bz2 luajit-82f7d0907cba3cef96c49bed4b4a64b228a6fd97.zip | |
Fix PE object build on x64 and with disabled interpreter.
| -rw-r--r-- | src/buildvm_peobj.c | 7 |
1 files changed, 5 insertions, 2 deletions
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, | |||
| 129 | memset(sym.n.name+len, 0, 8-len); | 129 | memset(sym.n.name+len, 0, 8-len); |
| 130 | } else { | 130 | } else { |
| 131 | sym.n.nameref[0] = 0; | 131 | sym.n.nameref[0] = 0; |
| 132 | sym.n.nameref[1] = strtabofs; | 132 | sym.n.nameref[1] = (uint32_t)strtabofs; |
| 133 | memcpy(strtab + strtabofs, name, len); | 133 | memcpy(strtab + strtabofs, name, len); |
| 134 | strtab[strtabofs+len] = 0; | 134 | strtab[strtabofs+len] = 0; |
| 135 | strtabofs += len+1; | 135 | strtabofs += len+1; |
| @@ -225,6 +225,9 @@ void emit_peobj(BuildCtx *ctx) | |||
| 225 | for (nzsym = 0; ctx->sym_ofs[ctx->perm[nzsym]] < 0; nzsym++) ; | 225 | for (nzsym = 0; ctx->sym_ofs[ctx->perm[nzsym]] < 0; nzsym++) ; |
| 226 | for (relocsyms = 0; ctx->extnames[relocsyms]; relocsyms++) ; | 226 | for (relocsyms = 0; ctx->extnames[relocsyms]; relocsyms++) ; |
| 227 | pehdr.nsyms = 1+PEOBJ_NSECTIONS*2 + 1+(ctx->nsym-nzsym)+1 + relocsyms; | 227 | pehdr.nsyms = 1+PEOBJ_NSECTIONS*2 + 1+(ctx->nsym-nzsym)+1 + relocsyms; |
| 228 | #if !LJ_HASJIT | ||
| 229 | pehdr.nsyms -= 7; | ||
| 230 | #endif | ||
| 228 | 231 | ||
| 229 | /* Write PE object header and all sections. */ | 232 | /* Write PE object header and all sections. */ |
| 230 | owrite(ctx, &pehdr, sizeof(PEheader)); | 233 | owrite(ctx, &pehdr, sizeof(PEheader)); |
| @@ -306,7 +309,7 @@ void emit_peobj(BuildCtx *ctx) | |||
| 306 | break; | 309 | break; |
| 307 | /* 2nd pass: alloc strtab, write syms and copy strings. */ | 310 | /* 2nd pass: alloc strtab, write syms and copy strings. */ |
| 308 | strtab = (char *)malloc(strtabofs); | 311 | strtab = (char *)malloc(strtabofs); |
| 309 | *(uint32_t *)strtab = strtabofs; | 312 | *(uint32_t *)strtab = (uint32_t)strtabofs; |
| 310 | } | 313 | } |
| 311 | 314 | ||
| 312 | /* Write string table. */ | 315 | /* Write string table. */ |
