diff options
Diffstat (limited to 'src/buildvm_x86.h')
-rw-r--r-- | src/buildvm_x86.h | 65 |
1 files changed, 24 insertions, 41 deletions
diff --git a/src/buildvm_x86.h b/src/buildvm_x86.h index fec4d3f9..c36e2aa5 100644 --- a/src/buildvm_x86.h +++ b/src/buildvm_x86.h | |||
@@ -2529,50 +2529,33 @@ static void emit_asm_debug(BuildCtx *ctx) | |||
2529 | "\t.align " BSZPTR "\n" | 2529 | "\t.align " BSZPTR "\n" |
2530 | "LECIEX:\n\n"); | 2530 | "LECIEX:\n\n"); |
2531 | for (i = 0; i < ctx->nsym; i++) { | 2531 | for (i = 0; i < ctx->nsym; i++) { |
2532 | int pi = ctx->perm[i]; | 2532 | const char *name = ctx->sym[i].name; |
2533 | int ni = ctx->perm[i+1]; | 2533 | int32_t size = ctx->sym[i+1].ofs - ctx->sym[i].ofs; |
2534 | int size = ctx->sym_ofs[ni] - ctx->sym_ofs[pi]; | 2534 | fprintf(ctx->fp, |
2535 | if (ctx->sym_ofs[pi] >= 0 && size > 0) { | 2535 | "%s.eh:\n" |
2536 | char name[80]; | 2536 | "LSFDE%d:\n" |
2537 | if (pi >= ctx->npc) { | 2537 | "\t.set L$set$%d,LEFDE%d-LASFDE%d\n" |
2538 | char *p; | 2538 | "\t.long L$set$%d\n" |
2539 | sprintf(name, "_" LABEL_PREFIX "%s", ctx->globnames[pi - ctx->npc]); | 2539 | "LASFDE%d:\n" |
2540 | p = strchr(name, '@'); if (p) *p = '\0'; | 2540 | "\t.long LASFDE%d-EH_frame1\n" |
2541 | #if LJ_HASJIT | 2541 | "\t.long %s-.\n" |
2542 | } else { | 2542 | "\t.long %d\n" |
2543 | #else | 2543 | "\t.byte 0\n" /* augmentation length */ |
2544 | } else if (!(pi == BC_JFORI || pi == BC_JFORL || pi == BC_JITERL || | 2544 | "\t.byte 0xe\n\t.byte %d\n" /* def_cfa_offset */ |
2545 | pi == BC_JLOOP || pi == BC_IFORL || pi == BC_IITERL || | ||
2546 | pi == BC_ILOOP)) { | ||
2547 | #endif | ||
2548 | sprintf(name, "_" LABEL_PREFIX_BC "%s", bc_names[pi]); | ||
2549 | } | ||
2550 | fprintf(ctx->fp, | ||
2551 | "%s.eh:\n" | ||
2552 | "LSFDE%d:\n" | ||
2553 | "\t.set L$set$%d,LEFDE%d-LASFDE%d\n" | ||
2554 | "\t.long L$set$%d\n" | ||
2555 | "LASFDE%d:\n" | ||
2556 | "\t.long LASFDE%d-EH_frame1\n" | ||
2557 | "\t.long %s-.\n" | ||
2558 | "\t.long %d\n" | ||
2559 | "\t.byte 0\n" /* augmentation length */ | ||
2560 | "\t.byte 0xe\n\t.byte %d\n" /* def_cfa_offset */ | ||
2561 | #if LJ_64 | 2545 | #if LJ_64 |
2562 | "\t.byte 0x86\n\t.byte 0x2\n" /* offset rbp */ | 2546 | "\t.byte 0x86\n\t.byte 0x2\n" /* offset rbp */ |
2563 | "\t.byte 0x83\n\t.byte 0x3\n" /* offset rbx */ | 2547 | "\t.byte 0x83\n\t.byte 0x3\n" /* offset rbx */ |
2564 | "\t.byte 0x8f\n\t.byte 0x4\n" /* offset r15 */ | 2548 | "\t.byte 0x8f\n\t.byte 0x4\n" /* offset r15 */ |
2565 | "\t.byte 0x8e\n\t.byte 0x5\n" /* offset r14 */ | 2549 | "\t.byte 0x8e\n\t.byte 0x5\n" /* offset r14 */ |
2566 | #else | 2550 | #else |
2567 | "\t.byte 0x84\n\t.byte 0x2\n" /* offset ebp (4 for MACH-O)*/ | 2551 | "\t.byte 0x84\n\t.byte 0x2\n" /* offset ebp (4 for MACH-O)*/ |
2568 | "\t.byte 0x87\n\t.byte 0x3\n" /* offset edi */ | 2552 | "\t.byte 0x87\n\t.byte 0x3\n" /* offset edi */ |
2569 | "\t.byte 0x86\n\t.byte 0x4\n" /* offset esi */ | 2553 | "\t.byte 0x86\n\t.byte 0x4\n" /* offset esi */ |
2570 | "\t.byte 0x83\n\t.byte 0x5\n" /* offset ebx */ | 2554 | "\t.byte 0x83\n\t.byte 0x5\n" /* offset ebx */ |
2571 | #endif | 2555 | #endif |
2572 | "\t.align " BSZPTR "\n" | 2556 | "\t.align " BSZPTR "\n" |
2573 | "LEFDE%d:\n\n", | 2557 | "LEFDE%d:\n\n", |
2574 | name, i, i, i, i, i, i, i, name, size, CFRAME_SIZE, i); | 2558 | name, i, i, i, i, i, i, i, name, size, CFRAME_SIZE, i); |
2575 | } | ||
2576 | } | 2559 | } |
2577 | #if LJ_64 | 2560 | #if LJ_64 |
2578 | fprintf(ctx->fp, "\t.subsections_via_symbols\n"); | 2561 | fprintf(ctx->fp, "\t.subsections_via_symbols\n"); |