Fix PE object build for fastcall entry points into interpreter.

This commit is contained in:
Mike Pall 2010-01-05 22:13:20 +01:00
parent 9df01f96b9
commit b3e3bad0ff
4 changed files with 20 additions and 6 deletions

View File

@ -156,7 +156,11 @@ void emit_asm(BuildCtx *ctx)
int size = (int)(next - prev);
int32_t stop = next;
if (pi >= ctx->npc) {
char *p;
sprintf(name, LABEL_PREFIX "%s", ctx->globnames[pi-ctx->npc]);
/* Always strip fastcall suffix. Wrong for (unused) COFF on Win32. */
p = strchr(name, '@');
if (p) *p = '\0';
emit_asm_label(ctx, name, size, 1);
#if LJ_HASJIT
} else {

View File

@ -284,8 +284,18 @@ void emit_peobj(BuildCtx *ctx)
for (i = nzsym; i < ctx->nsym; i++) {
int pi = ctx->perm[i];
if (pi >= ctx->npc) {
sprintf(name, PEOBJ_SYM_PREFIX LABEL_PREFIX "%s",
ctx->globnames[pi-ctx->npc]);
const char *sym = ctx->globnames[pi-ctx->npc];
const char *p = strchr(sym, '@');
if (p) {
#ifdef PEOBJ_SYMF_PREFIX
sprintf(name, PEOBJ_SYMF_PREFIX LABEL_PREFIX "%s", sym);
#else
sprintf(name, LABEL_PREFIX "%s", sym);
name[p+sizeof(LABEL_PREFIX)] = '\0';
#endif
} else {
sprintf(name, PEOBJ_SYM_PREFIX LABEL_PREFIX "%s", sym);
}
emit_peobj_sym_func(ctx, name, ctx->sym_ofs[pi]);
#if LJ_HASJIT
} else {

View File

@ -613,7 +613,7 @@ static void build_subroutines(BuildCtx *ctx, int cmov, int sse)
| mov BASE, L:RB->top // Need the (realloced) L->top in BASE.
| jmp <3
|
|->vm_unwind_c: // Unwind C stack, return from vm_pcall.
|->vm_unwind_c@8: // Unwind C stack, return from vm_pcall.
| // (void *cframe, int errcode)
|.if X64
| mov eax, CARG2d // Error return status for vm_pcall.
@ -628,7 +628,7 @@ static void build_subroutines(BuildCtx *ctx, int cmov, int sse)
| mov dword GL:RB->vmstate, ~LJ_VMST_C
| jmp ->vm_leave_unw
|
|->vm_unwind_ff: // Unwind C stack, return from ff pcall.
|->vm_unwind_ff@4: // Unwind C stack, return from ff pcall.
| // (void *cframe)
|.if X64
| and CARG1, CFRAME_RAWMASK

View File

@ -912,9 +912,9 @@ static const char *const globnames[] = {
"vm_returnp",
"vm_leave_cp",
"vm_leave_unw",
"vm_unwind_c",
"vm_unwind_c@8",
"vm_unwind_c_eh",
"vm_unwind_ff",
"vm_unwind_ff@4",
"vm_unwind_ff_eh",
"cont_dispatch",
"vm_resume",