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) 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 { 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) 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 { 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) | 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 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[] = { "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",