diff options
Diffstat (limited to 'src/buildvm_x64.h')
-rw-r--r-- | src/buildvm_x64.h | 65 |
1 files changed, 24 insertions, 41 deletions
diff --git a/src/buildvm_x64.h b/src/buildvm_x64.h index b8d8f60a..747253fd 100644 --- a/src/buildvm_x64.h +++ b/src/buildvm_x64.h | |||
@@ -2403,50 +2403,33 @@ static void emit_asm_debug(BuildCtx *ctx) | |||
2403 | "\t.align " BSZPTR "\n" | 2403 | "\t.align " BSZPTR "\n" |
2404 | "LECIEX:\n\n"); | 2404 | "LECIEX:\n\n"); |
2405 | for (i = 0; i < ctx->nsym; i++) { | 2405 | for (i = 0; i < ctx->nsym; i++) { |
2406 | int pi = ctx->perm[i]; | 2406 | const char *name = ctx->sym[i].name; |
2407 | int ni = ctx->perm[i+1]; | 2407 | int32_t size = ctx->sym[i+1].ofs - ctx->sym[i].ofs; |
2408 | int size = ctx->sym_ofs[ni] - ctx->sym_ofs[pi]; | 2408 | fprintf(ctx->fp, |
2409 | if (ctx->sym_ofs[pi] >= 0 && size > 0) { | 2409 | "%s.eh:\n" |
2410 | char name[80]; | 2410 | "LSFDE%d:\n" |
2411 | if (pi >= ctx->npc) { | 2411 | "\t.set L$set$%d,LEFDE%d-LASFDE%d\n" |
2412 | char *p; | 2412 | "\t.long L$set$%d\n" |
2413 | sprintf(name, "_" LABEL_PREFIX "%s", ctx->globnames[pi - ctx->npc]); | 2413 | "LASFDE%d:\n" |
2414 | p = strchr(name, '@'); if (p) *p = '\0'; | 2414 | "\t.long LASFDE%d-EH_frame1\n" |
2415 | #if LJ_HASJIT | 2415 | "\t.long %s-.\n" |
2416 | } else { | 2416 | "\t.long %d\n" |
2417 | #else | 2417 | "\t.byte 0\n" /* augmentation length */ |
2418 | } else if (!(pi == BC_JFORI || pi == BC_JFORL || pi == BC_JITERL || | 2418 | "\t.byte 0xe\n\t.byte %d\n" /* def_cfa_offset */ |
2419 | pi == BC_JLOOP || pi == BC_IFORL || pi == BC_IITERL || | ||
2420 | pi == BC_ILOOP)) { | ||
2421 | #endif | ||
2422 | sprintf(name, "_" LABEL_PREFIX_BC "%s", bc_names[pi]); | ||
2423 | } | ||
2424 | fprintf(ctx->fp, | ||
2425 | "%s.eh:\n" | ||
2426 | "LSFDE%d:\n" | ||
2427 | "\t.set L$set$%d,LEFDE%d-LASFDE%d\n" | ||
2428 | "\t.long L$set$%d\n" | ||
2429 | "LASFDE%d:\n" | ||
2430 | "\t.long LASFDE%d-EH_frame1\n" | ||
2431 | "\t.long %s-.\n" | ||
2432 | "\t.long %d\n" | ||
2433 | "\t.byte 0\n" /* augmentation length */ | ||
2434 | "\t.byte 0xe\n\t.byte %d\n" /* def_cfa_offset */ | ||
2435 | #if LJ_64 | 2419 | #if LJ_64 |
2436 | "\t.byte 0x86\n\t.byte 0x2\n" /* offset rbp */ | 2420 | "\t.byte 0x86\n\t.byte 0x2\n" /* offset rbp */ |
2437 | "\t.byte 0x83\n\t.byte 0x3\n" /* offset rbx */ | 2421 | "\t.byte 0x83\n\t.byte 0x3\n" /* offset rbx */ |
2438 | "\t.byte 0x8f\n\t.byte 0x4\n" /* offset r15 */ | 2422 | "\t.byte 0x8f\n\t.byte 0x4\n" /* offset r15 */ |
2439 | "\t.byte 0x8e\n\t.byte 0x5\n" /* offset r14 */ | 2423 | "\t.byte 0x8e\n\t.byte 0x5\n" /* offset r14 */ |
2440 | #else | 2424 | #else |
2441 | "\t.byte 0x84\n\t.byte 0x2\n" /* offset ebp (4 for MACH-O)*/ | 2425 | "\t.byte 0x84\n\t.byte 0x2\n" /* offset ebp (4 for MACH-O)*/ |
2442 | "\t.byte 0x87\n\t.byte 0x3\n" /* offset edi */ | 2426 | "\t.byte 0x87\n\t.byte 0x3\n" /* offset edi */ |
2443 | "\t.byte 0x86\n\t.byte 0x4\n" /* offset esi */ | 2427 | "\t.byte 0x86\n\t.byte 0x4\n" /* offset esi */ |
2444 | "\t.byte 0x83\n\t.byte 0x5\n" /* offset ebx */ | 2428 | "\t.byte 0x83\n\t.byte 0x5\n" /* offset ebx */ |
2445 | #endif | 2429 | #endif |
2446 | "\t.align " BSZPTR "\n" | 2430 | "\t.align " BSZPTR "\n" |
2447 | "LEFDE%d:\n\n", | 2431 | "LEFDE%d:\n\n", |
2448 | name, i, i, i, i, i, i, i, name, size, CFRAME_SIZE, i); | 2432 | name, i, i, i, i, i, i, i, name, size, CFRAME_SIZE, i); |
2449 | } | ||
2450 | } | 2433 | } |
2451 | #if LJ_64 | 2434 | #if LJ_64 |
2452 | fprintf(ctx->fp, "\t.subsections_via_symbols\n"); | 2435 | fprintf(ctx->fp, "\t.subsections_via_symbols\n"); |