aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMike Pall <mike>2010-01-05 22:13:20 +0100
committerMike Pall <mike>2010-01-05 22:13:20 +0100
commitb3e3bad0ffffe9e1a23c658b99810c687905005d (patch)
treed29e6563dc8cab849f74310ee821cc6d1fafaf07 /src
parent9df01f96b960c1db9fd123a14a443614aa4ac30c (diff)
downloadluajit-b3e3bad0ffffe9e1a23c658b99810c687905005d.tar.gz
luajit-b3e3bad0ffffe9e1a23c658b99810c687905005d.tar.bz2
luajit-b3e3bad0ffffe9e1a23c658b99810c687905005d.zip
Fix PE object build for fastcall entry points into interpreter.
Diffstat (limited to 'src')
-rw-r--r--src/buildvm_asm.c4
-rw-r--r--src/buildvm_peobj.c14
-rw-r--r--src/buildvm_x86.dasc4
-rw-r--r--src/buildvm_x86.h4
4 files changed, 20 insertions, 6 deletions
diff --git a/src/buildvm_asm.c b/src/buildvm_asm.c
index 31b6f61e..295b07ef 100644
--- a/src/buildvm_asm.c
+++ b/src/buildvm_asm.c
@@ -156,7 +156,11 @@ void emit_asm(BuildCtx *ctx)
156 int size = (int)(next - prev); 156 int size = (int)(next - prev);
157 int32_t stop = next; 157 int32_t stop = next;
158 if (pi >= ctx->npc) { 158 if (pi >= ctx->npc) {
159 char *p;
159 sprintf(name, LABEL_PREFIX "%s", ctx->globnames[pi-ctx->npc]); 160 sprintf(name, LABEL_PREFIX "%s", ctx->globnames[pi-ctx->npc]);
161 /* Always strip fastcall suffix. Wrong for (unused) COFF on Win32. */
162 p = strchr(name, '@');
163 if (p) *p = '\0';
160 emit_asm_label(ctx, name, size, 1); 164 emit_asm_label(ctx, name, size, 1);
161#if LJ_HASJIT 165#if LJ_HASJIT
162 } else { 166 } else {
diff --git a/src/buildvm_peobj.c b/src/buildvm_peobj.c
index 4b5d98c6..d45f3c97 100644
--- a/src/buildvm_peobj.c
+++ b/src/buildvm_peobj.c
@@ -284,8 +284,18 @@ void emit_peobj(BuildCtx *ctx)
284 for (i = nzsym; i < ctx->nsym; i++) { 284 for (i = nzsym; i < ctx->nsym; i++) {
285 int pi = ctx->perm[i]; 285 int pi = ctx->perm[i];
286 if (pi >= ctx->npc) { 286 if (pi >= ctx->npc) {
287 sprintf(name, PEOBJ_SYM_PREFIX LABEL_PREFIX "%s", 287 const char *sym = ctx->globnames[pi-ctx->npc];
288 ctx->globnames[pi-ctx->npc]); 288 const char *p = strchr(sym, '@');
289 if (p) {
290#ifdef PEOBJ_SYMF_PREFIX
291 sprintf(name, PEOBJ_SYMF_PREFIX LABEL_PREFIX "%s", sym);
292#else
293 sprintf(name, LABEL_PREFIX "%s", sym);
294 name[p+sizeof(LABEL_PREFIX)] = '\0';
295#endif
296 } else {
297 sprintf(name, PEOBJ_SYM_PREFIX LABEL_PREFIX "%s", sym);
298 }
289 emit_peobj_sym_func(ctx, name, ctx->sym_ofs[pi]); 299 emit_peobj_sym_func(ctx, name, ctx->sym_ofs[pi]);
290#if LJ_HASJIT 300#if LJ_HASJIT
291 } else { 301 } else {
diff --git a/src/buildvm_x86.dasc b/src/buildvm_x86.dasc
index f19ecbc0..be2ee71e 100644
--- a/src/buildvm_x86.dasc
+++ b/src/buildvm_x86.dasc
@@ -613,7 +613,7 @@ static void build_subroutines(BuildCtx *ctx, int cmov, int sse)
613 | mov BASE, L:RB->top // Need the (realloced) L->top in BASE. 613 | mov BASE, L:RB->top // Need the (realloced) L->top in BASE.
614 | jmp <3 614 | jmp <3
615 | 615 |
616 |->vm_unwind_c: // Unwind C stack, return from vm_pcall. 616 |->vm_unwind_c@8: // Unwind C stack, return from vm_pcall.
617 | // (void *cframe, int errcode) 617 | // (void *cframe, int errcode)
618 |.if X64 618 |.if X64
619 | mov eax, CARG2d // Error return status for vm_pcall. 619 | mov eax, CARG2d // Error return status for vm_pcall.
@@ -628,7 +628,7 @@ static void build_subroutines(BuildCtx *ctx, int cmov, int sse)
628 | mov dword GL:RB->vmstate, ~LJ_VMST_C 628 | mov dword GL:RB->vmstate, ~LJ_VMST_C
629 | jmp ->vm_leave_unw 629 | jmp ->vm_leave_unw
630 | 630 |
631 |->vm_unwind_ff: // Unwind C stack, return from ff pcall. 631 |->vm_unwind_ff@4: // Unwind C stack, return from ff pcall.
632 | // (void *cframe) 632 | // (void *cframe)
633 |.if X64 633 |.if X64
634 | and CARG1, CFRAME_RAWMASK 634 | and CARG1, CFRAME_RAWMASK
diff --git a/src/buildvm_x86.h b/src/buildvm_x86.h
index 8ae53756..030ac179 100644
--- a/src/buildvm_x86.h
+++ b/src/buildvm_x86.h
@@ -912,9 +912,9 @@ static const char *const globnames[] = {
912 "vm_returnp", 912 "vm_returnp",
913 "vm_leave_cp", 913 "vm_leave_cp",
914 "vm_leave_unw", 914 "vm_leave_unw",
915 "vm_unwind_c", 915 "vm_unwind_c@8",
916 "vm_unwind_c_eh", 916 "vm_unwind_c_eh",
917 "vm_unwind_ff", 917 "vm_unwind_ff@4",
918 "vm_unwind_ff_eh", 918 "vm_unwind_ff_eh",
919 "cont_dispatch", 919 "cont_dispatch",
920 "vm_resume", 920 "vm_resume",