diff options
author | Mike Pall <mike> | 2009-12-29 05:25:24 +0100 |
---|---|---|
committer | Mike Pall <mike> | 2009-12-29 05:25:24 +0100 |
commit | 42124227cf8c490f113c6e4b5253970f17864a79 (patch) | |
tree | 9ae2d1c143a5b7f9b699e0587f4eff6d28484d3b /src | |
parent | 24429ed1f5c52258700e2e16c898c1dd9b8c4203 (diff) | |
download | luajit-42124227cf8c490f113c6e4b5253970f17864a79.tar.gz luajit-42124227cf8c490f113c6e4b5253970f17864a79.tar.bz2 luajit-42124227cf8c490f113c6e4b5253970f17864a79.zip |
Add DWARF2 unwind info for x64 interpreter.
Diffstat (limited to 'src')
-rw-r--r-- | src/buildvm_x86.dasc | 88 | ||||
-rw-r--r-- | src/buildvm_x86.h | 88 |
2 files changed, 130 insertions, 46 deletions
diff --git a/src/buildvm_x86.dasc b/src/buildvm_x86.dasc index 0fe7cd88..c110b098 100644 --- a/src/buildvm_x86.dasc +++ b/src/buildvm_x86.dasc | |||
@@ -4832,6 +4832,17 @@ static int build_backend(BuildCtx *ctx) | |||
4832 | /* Emit pseudo frame-info for all assembler functions. */ | 4832 | /* Emit pseudo frame-info for all assembler functions. */ |
4833 | static void emit_asm_debug(BuildCtx *ctx) | 4833 | static void emit_asm_debug(BuildCtx *ctx) |
4834 | { | 4834 | { |
4835 | #if LJ_64 | ||
4836 | #define SZPTR "8" | ||
4837 | #define BSZPTR "3" | ||
4838 | #define REG_SP "0x7" | ||
4839 | #define REG_RA "0x10" | ||
4840 | #else | ||
4841 | #define SZPTR "4" | ||
4842 | #define BSZPTR "2" | ||
4843 | #define REG_SP "0x4" | ||
4844 | #define REG_RA "0x8" | ||
4845 | #endif | ||
4835 | switch (ctx->mode) { | 4846 | switch (ctx->mode) { |
4836 | case BUILD_elfasm: | 4847 | case BUILD_elfasm: |
4837 | fprintf(ctx->fp, "\t.section .debug_frame,\"\",@progbits\n"); | 4848 | fprintf(ctx->fp, "\t.section .debug_frame,\"\",@progbits\n"); |
@@ -4843,11 +4854,11 @@ static void emit_asm_debug(BuildCtx *ctx) | |||
4843 | "\t.byte 0x1\n" | 4854 | "\t.byte 0x1\n" |
4844 | "\t.string \"\"\n" | 4855 | "\t.string \"\"\n" |
4845 | "\t.uleb128 0x1\n" | 4856 | "\t.uleb128 0x1\n" |
4846 | "\t.sleb128 -4\n" | 4857 | "\t.sleb128 -" SZPTR "\n" |
4847 | "\t.byte 0x8\n" | 4858 | "\t.byte " REG_RA "\n" |
4848 | "\t.byte 0xc\n\t.uleb128 0x4\n\t.uleb128 0x4\n" | 4859 | "\t.byte 0xc\n\t.uleb128 " REG_SP "\n\t.uleb128 " SZPTR "\n" |
4849 | "\t.byte 0x88\n\t.uleb128 0x1\n" | 4860 | "\t.byte 0x80+" REG_RA "\n\t.uleb128 0x1\n" |
4850 | "\t.align 4\n" | 4861 | "\t.align " SZPTR "\n" |
4851 | ".LECIE0:\n\n"); | 4862 | ".LECIE0:\n\n"); |
4852 | fprintf(ctx->fp, | 4863 | fprintf(ctx->fp, |
4853 | ".LSFDE0:\n" | 4864 | ".LSFDE0:\n" |
@@ -4856,13 +4867,22 @@ static void emit_asm_debug(BuildCtx *ctx) | |||
4856 | "\t.long .Lframe0\n" | 4867 | "\t.long .Lframe0\n" |
4857 | "\t.long .Lbegin\n" | 4868 | "\t.long .Lbegin\n" |
4858 | "\t.long %d\n" | 4869 | "\t.long %d\n" |
4859 | "\t.byte 0xe\n\t.uleb128 0x30\n" /* def_cfa_offset */ | 4870 | "\t.byte 0xe\n\t.uleb128 %d\n" /* def_cfa_offset */ |
4871 | #if LJ_64 | ||
4872 | "\t.byte 0x86\n\t.uleb128 0x2\n" /* offset rbp */ | ||
4873 | "\t.byte 0x83\n\t.uleb128 0x3\n" /* offset rbx */ | ||
4874 | "\t.byte 0x8f\n\t.uleb128 0x4\n" /* offset r15 */ | ||
4875 | "\t.byte 0x8e\n\t.uleb128 0x5\n" /* offset r14 */ | ||
4876 | "\t.byte 0x8d\n\t.uleb128 0x6\n" /* offset r13 */ | ||
4877 | "\t.byte 0x8c\n\t.uleb128 0x7\n" /* offset r12 */ | ||
4878 | #else | ||
4860 | "\t.byte 0x85\n\t.uleb128 0x2\n" /* offset ebp */ | 4879 | "\t.byte 0x85\n\t.uleb128 0x2\n" /* offset ebp */ |
4861 | "\t.byte 0x87\n\t.uleb128 0x3\n" /* offset edi */ | 4880 | "\t.byte 0x87\n\t.uleb128 0x3\n" /* offset edi */ |
4862 | "\t.byte 0x86\n\t.uleb128 0x4\n" /* offset esi */ | 4881 | "\t.byte 0x86\n\t.uleb128 0x4\n" /* offset esi */ |
4863 | "\t.byte 0x83\n\t.uleb128 0x5\n" /* offset ebx */ | 4882 | "\t.byte 0x83\n\t.uleb128 0x5\n" /* offset ebx */ |
4864 | "\t.align 4\n" | 4883 | #endif |
4865 | ".LEFDE0:\n\n", (int)ctx->codesz); | 4884 | "\t.align " SZPTR "\n" |
4885 | ".LEFDE0:\n\n", (int)ctx->codesz, CFRAME_SIZE); | ||
4866 | fprintf(ctx->fp, "\t.section .eh_frame,\"a\",@progbits\n"); | 4886 | fprintf(ctx->fp, "\t.section .eh_frame,\"a\",@progbits\n"); |
4867 | fprintf(ctx->fp, | 4887 | fprintf(ctx->fp, |
4868 | ".Lframe1:\n" | 4888 | ".Lframe1:\n" |
@@ -4872,15 +4892,15 @@ static void emit_asm_debug(BuildCtx *ctx) | |||
4872 | "\t.byte 0x1\n" | 4892 | "\t.byte 0x1\n" |
4873 | "\t.string \"zPR\"\n" | 4893 | "\t.string \"zPR\"\n" |
4874 | "\t.uleb128 0x1\n" | 4894 | "\t.uleb128 0x1\n" |
4875 | "\t.sleb128 -4\n" | 4895 | "\t.sleb128 -" SZPTR "\n" |
4876 | "\t.byte 0x8\n" | 4896 | "\t.byte " REG_RA "\n" |
4877 | "\t.uleb128 6\n" /* augmentation length */ | 4897 | "\t.uleb128 6\n" /* augmentation length */ |
4878 | "\t.byte 0x1b\n" /* pcrel|sdata4 */ | 4898 | "\t.byte 0x1b\n" /* pcrel|sdata4 */ |
4879 | "\t.long lj_err_unwind_dwarf-.\n" | 4899 | "\t.long lj_err_unwind_dwarf-.\n" |
4880 | "\t.byte 0x1b\n" /* pcrel|sdata4 */ | 4900 | "\t.byte 0x1b\n" /* pcrel|sdata4 */ |
4881 | "\t.byte 0xc\n\t.uleb128 0x4\n\t.uleb128 0x4\n" | 4901 | "\t.byte 0xc\n\t.uleb128 " REG_SP "\n\t.uleb128 " SZPTR "\n" |
4882 | "\t.byte 0x88\n\t.uleb128 0x1\n" | 4902 | "\t.byte 0x80+" REG_RA "\n\t.uleb128 0x1\n" |
4883 | "\t.align 4\n" | 4903 | "\t.align " SZPTR "\n" |
4884 | ".LECIE1:\n\n"); | 4904 | ".LECIE1:\n\n"); |
4885 | fprintf(ctx->fp, | 4905 | fprintf(ctx->fp, |
4886 | ".LSFDE1:\n" | 4906 | ".LSFDE1:\n" |
@@ -4890,13 +4910,22 @@ static void emit_asm_debug(BuildCtx *ctx) | |||
4890 | "\t.long .Lbegin-.\n" | 4910 | "\t.long .Lbegin-.\n" |
4891 | "\t.long %d\n" | 4911 | "\t.long %d\n" |
4892 | "\t.uleb128 0\n" /* augmentation length */ | 4912 | "\t.uleb128 0\n" /* augmentation length */ |
4893 | "\t.byte 0xe\n\t.uleb128 0x30\n" /* def_cfa_offset */ | 4913 | "\t.byte 0xe\n\t.uleb128 %d\n" /* def_cfa_offset */ |
4914 | #if LJ_64 | ||
4915 | "\t.byte 0x86\n\t.uleb128 0x2\n" /* offset rbp */ | ||
4916 | "\t.byte 0x83\n\t.uleb128 0x3\n" /* offset rbx */ | ||
4917 | "\t.byte 0x8f\n\t.uleb128 0x4\n" /* offset r15 */ | ||
4918 | "\t.byte 0x8e\n\t.uleb128 0x5\n" /* offset r14 */ | ||
4919 | "\t.byte 0x8d\n\t.uleb128 0x6\n" /* offset r13 */ | ||
4920 | "\t.byte 0x8c\n\t.uleb128 0x7\n" /* offset r12 */ | ||
4921 | #else | ||
4894 | "\t.byte 0x85\n\t.uleb128 0x2\n" /* offset ebp */ | 4922 | "\t.byte 0x85\n\t.uleb128 0x2\n" /* offset ebp */ |
4895 | "\t.byte 0x87\n\t.uleb128 0x3\n" /* offset edi */ | 4923 | "\t.byte 0x87\n\t.uleb128 0x3\n" /* offset edi */ |
4896 | "\t.byte 0x86\n\t.uleb128 0x4\n" /* offset esi */ | 4924 | "\t.byte 0x86\n\t.uleb128 0x4\n" /* offset esi */ |
4897 | "\t.byte 0x83\n\t.uleb128 0x5\n" /* offset ebx */ | 4925 | "\t.byte 0x83\n\t.uleb128 0x5\n" /* offset ebx */ |
4898 | "\t.align 4\n" | 4926 | #endif |
4899 | ".LEFDE1:\n\n", (int)ctx->codesz); | 4927 | "\t.align " SZPTR "\n" |
4928 | ".LEFDE1:\n\n", (int)ctx->codesz, CFRAME_SIZE); | ||
4900 | break; | 4929 | break; |
4901 | case BUILD_machasm: | 4930 | case BUILD_machasm: |
4902 | fprintf(ctx->fp, "\t.section __TEXT,__eh_frame,coalesced,no_toc+strip_static_syms+live_support\n"); | 4931 | fprintf(ctx->fp, "\t.section __TEXT,__eh_frame,coalesced,no_toc+strip_static_syms+live_support\n"); |
@@ -4909,15 +4938,19 @@ static void emit_asm_debug(BuildCtx *ctx) | |||
4909 | "\t.byte 0x1\n" | 4938 | "\t.byte 0x1\n" |
4910 | "\t.ascii \"zPR\\0\"\n" | 4939 | "\t.ascii \"zPR\\0\"\n" |
4911 | "\t.byte 0x1\n" | 4940 | "\t.byte 0x1\n" |
4912 | "\t.byte 128-4\n" | 4941 | "\t.byte 128-" SZPTR "\n" |
4913 | "\t.byte 0x8\n" | 4942 | "\t.byte " REG_RA "\n" |
4914 | "\t.byte 6\n" /* augmentation length */ | 4943 | "\t.byte 6\n" /* augmentation length */ |
4915 | "\t.byte 0x9b\n" /* indirect|pcrel|sdata4 */ | 4944 | "\t.byte 0x9b\n" /* indirect|pcrel|sdata4 */ |
4916 | "\t.long L_lj_err_unwind_dwarf$non_lazy_ptr-.\n" | 4945 | "\t.long L_lj_err_unwind_dwarf$non_lazy_ptr-.\n" |
4917 | "\t.byte 0x1b\n" /* pcrel|sdata4 */ | 4946 | "\t.byte 0x1b\n" /* pcrel|sdata4 */ |
4947 | #if LJ_64 | ||
4948 | "\t.byte 0xc\n\t.byte " REG_SP "\n\t.byte " SZPTR "\n" | ||
4949 | #else | ||
4918 | "\t.byte 0xc\n\t.byte 0x5\n\t.byte 0x4\n" /* esp=5 on 32 bit MACH-O. */ | 4950 | "\t.byte 0xc\n\t.byte 0x5\n\t.byte 0x4\n" /* esp=5 on 32 bit MACH-O. */ |
4919 | "\t.byte 0x88\n\t.byte 0x1\n" | 4951 | #endif |
4920 | "\t.align 2\n" | 4952 | "\t.byte 0x80+" REG_RA "\n\t.byte 0x1\n" |
4953 | "\t.align " BSZPTR "\n" | ||
4921 | "LECIE1:\n\n"); | 4954 | "LECIE1:\n\n"); |
4922 | fprintf(ctx->fp, | 4955 | fprintf(ctx->fp, |
4923 | "_lj_vm_asm_begin.eh:\n" | 4956 | "_lj_vm_asm_begin.eh:\n" |
@@ -4929,13 +4962,22 @@ static void emit_asm_debug(BuildCtx *ctx) | |||
4929 | "\t.long _lj_vm_asm_begin-.\n" | 4962 | "\t.long _lj_vm_asm_begin-.\n" |
4930 | "\t.long %d\n" | 4963 | "\t.long %d\n" |
4931 | "\t.byte 0\n" /* augmentation length */ | 4964 | "\t.byte 0\n" /* augmentation length */ |
4932 | "\t.byte 0xe\n\t.byte 0x30\n" /* def_cfa_offset */ | 4965 | "\t.byte 0xe\n\t.byte %d\n" /* def_cfa_offset */ |
4966 | #if LJ_64 | ||
4967 | "\t.byte 0x86\n\t.uleb128 0x2\n" /* offset rbp */ | ||
4968 | "\t.byte 0x83\n\t.uleb128 0x3\n" /* offset rbx */ | ||
4969 | "\t.byte 0x8f\n\t.uleb128 0x4\n" /* offset r15 */ | ||
4970 | "\t.byte 0x8e\n\t.uleb128 0x5\n" /* offset r14 */ | ||
4971 | "\t.byte 0x8d\n\t.uleb128 0x6\n" /* offset r13 */ | ||
4972 | "\t.byte 0x8c\n\t.uleb128 0x7\n" /* offset r12 */ | ||
4973 | #else | ||
4933 | "\t.byte 0x84\n\t.byte 0x2\n" /* offset ebp (4 for MACH-O)*/ | 4974 | "\t.byte 0x84\n\t.byte 0x2\n" /* offset ebp (4 for MACH-O)*/ |
4934 | "\t.byte 0x87\n\t.byte 0x3\n" /* offset edi */ | 4975 | "\t.byte 0x87\n\t.byte 0x3\n" /* offset edi */ |
4935 | "\t.byte 0x86\n\t.byte 0x4\n" /* offset esi */ | 4976 | "\t.byte 0x86\n\t.byte 0x4\n" /* offset esi */ |
4936 | "\t.byte 0x83\n\t.byte 0x5\n" /* offset ebx */ | 4977 | "\t.byte 0x83\n\t.byte 0x5\n" /* offset ebx */ |
4937 | "\t.align 2\n" | 4978 | #endif |
4938 | "LEFDE1:\n\n", (int)ctx->codesz); | 4979 | "\t.align " BSZPTR "\n" |
4980 | "LEFDE1:\n\n", (int)ctx->codesz, CFRAME_SIZE); | ||
4939 | fprintf(ctx->fp, | 4981 | fprintf(ctx->fp, |
4940 | "\t.non_lazy_symbol_pointer\n" | 4982 | "\t.non_lazy_symbol_pointer\n" |
4941 | "L_lj_err_unwind_dwarf$non_lazy_ptr:\n" | 4983 | "L_lj_err_unwind_dwarf$non_lazy_ptr:\n" |
diff --git a/src/buildvm_x86.h b/src/buildvm_x86.h index c9907583..c7eb42e3 100644 --- a/src/buildvm_x86.h +++ b/src/buildvm_x86.h | |||
@@ -2305,6 +2305,17 @@ static int build_backend(BuildCtx *ctx) | |||
2305 | /* Emit pseudo frame-info for all assembler functions. */ | 2305 | /* Emit pseudo frame-info for all assembler functions. */ |
2306 | static void emit_asm_debug(BuildCtx *ctx) | 2306 | static void emit_asm_debug(BuildCtx *ctx) |
2307 | { | 2307 | { |
2308 | #if LJ_64 | ||
2309 | #define SZPTR "8" | ||
2310 | #define BSZPTR "3" | ||
2311 | #define REG_SP "0x7" | ||
2312 | #define REG_RA "0x10" | ||
2313 | #else | ||
2314 | #define SZPTR "4" | ||
2315 | #define BSZPTR "2" | ||
2316 | #define REG_SP "0x4" | ||
2317 | #define REG_RA "0x8" | ||
2318 | #endif | ||
2308 | switch (ctx->mode) { | 2319 | switch (ctx->mode) { |
2309 | case BUILD_elfasm: | 2320 | case BUILD_elfasm: |
2310 | fprintf(ctx->fp, "\t.section .debug_frame,\"\",@progbits\n"); | 2321 | fprintf(ctx->fp, "\t.section .debug_frame,\"\",@progbits\n"); |
@@ -2316,11 +2327,11 @@ static void emit_asm_debug(BuildCtx *ctx) | |||
2316 | "\t.byte 0x1\n" | 2327 | "\t.byte 0x1\n" |
2317 | "\t.string \"\"\n" | 2328 | "\t.string \"\"\n" |
2318 | "\t.uleb128 0x1\n" | 2329 | "\t.uleb128 0x1\n" |
2319 | "\t.sleb128 -4\n" | 2330 | "\t.sleb128 -" SZPTR "\n" |
2320 | "\t.byte 0x8\n" | 2331 | "\t.byte " REG_RA "\n" |
2321 | "\t.byte 0xc\n\t.uleb128 0x4\n\t.uleb128 0x4\n" | 2332 | "\t.byte 0xc\n\t.uleb128 " REG_SP "\n\t.uleb128 " SZPTR "\n" |
2322 | "\t.byte 0x88\n\t.uleb128 0x1\n" | 2333 | "\t.byte 0x80+" REG_RA "\n\t.uleb128 0x1\n" |
2323 | "\t.align 4\n" | 2334 | "\t.align " SZPTR "\n" |
2324 | ".LECIE0:\n\n"); | 2335 | ".LECIE0:\n\n"); |
2325 | fprintf(ctx->fp, | 2336 | fprintf(ctx->fp, |
2326 | ".LSFDE0:\n" | 2337 | ".LSFDE0:\n" |
@@ -2329,13 +2340,22 @@ static void emit_asm_debug(BuildCtx *ctx) | |||
2329 | "\t.long .Lframe0\n" | 2340 | "\t.long .Lframe0\n" |
2330 | "\t.long .Lbegin\n" | 2341 | "\t.long .Lbegin\n" |
2331 | "\t.long %d\n" | 2342 | "\t.long %d\n" |
2332 | "\t.byte 0xe\n\t.uleb128 0x30\n" /* def_cfa_offset */ | 2343 | "\t.byte 0xe\n\t.uleb128 %d\n" /* def_cfa_offset */ |
2344 | #if LJ_64 | ||
2345 | "\t.byte 0x86\n\t.uleb128 0x2\n" /* offset rbp */ | ||
2346 | "\t.byte 0x83\n\t.uleb128 0x3\n" /* offset rbx */ | ||
2347 | "\t.byte 0x8f\n\t.uleb128 0x4\n" /* offset r15 */ | ||
2348 | "\t.byte 0x8e\n\t.uleb128 0x5\n" /* offset r14 */ | ||
2349 | "\t.byte 0x8d\n\t.uleb128 0x6\n" /* offset r13 */ | ||
2350 | "\t.byte 0x8c\n\t.uleb128 0x7\n" /* offset r12 */ | ||
2351 | #else | ||
2333 | "\t.byte 0x85\n\t.uleb128 0x2\n" /* offset ebp */ | 2352 | "\t.byte 0x85\n\t.uleb128 0x2\n" /* offset ebp */ |
2334 | "\t.byte 0x87\n\t.uleb128 0x3\n" /* offset edi */ | 2353 | "\t.byte 0x87\n\t.uleb128 0x3\n" /* offset edi */ |
2335 | "\t.byte 0x86\n\t.uleb128 0x4\n" /* offset esi */ | 2354 | "\t.byte 0x86\n\t.uleb128 0x4\n" /* offset esi */ |
2336 | "\t.byte 0x83\n\t.uleb128 0x5\n" /* offset ebx */ | 2355 | "\t.byte 0x83\n\t.uleb128 0x5\n" /* offset ebx */ |
2337 | "\t.align 4\n" | 2356 | #endif |
2338 | ".LEFDE0:\n\n", (int)ctx->codesz); | 2357 | "\t.align " SZPTR "\n" |
2358 | ".LEFDE0:\n\n", (int)ctx->codesz, CFRAME_SIZE); | ||
2339 | fprintf(ctx->fp, "\t.section .eh_frame,\"a\",@progbits\n"); | 2359 | fprintf(ctx->fp, "\t.section .eh_frame,\"a\",@progbits\n"); |
2340 | fprintf(ctx->fp, | 2360 | fprintf(ctx->fp, |
2341 | ".Lframe1:\n" | 2361 | ".Lframe1:\n" |
@@ -2345,15 +2365,15 @@ static void emit_asm_debug(BuildCtx *ctx) | |||
2345 | "\t.byte 0x1\n" | 2365 | "\t.byte 0x1\n" |
2346 | "\t.string \"zPR\"\n" | 2366 | "\t.string \"zPR\"\n" |
2347 | "\t.uleb128 0x1\n" | 2367 | "\t.uleb128 0x1\n" |
2348 | "\t.sleb128 -4\n" | 2368 | "\t.sleb128 -" SZPTR "\n" |
2349 | "\t.byte 0x8\n" | 2369 | "\t.byte " REG_RA "\n" |
2350 | "\t.uleb128 6\n" /* augmentation length */ | 2370 | "\t.uleb128 6\n" /* augmentation length */ |
2351 | "\t.byte 0x1b\n" /* pcrel|sdata4 */ | 2371 | "\t.byte 0x1b\n" /* pcrel|sdata4 */ |
2352 | "\t.long lj_err_unwind_dwarf-.\n" | 2372 | "\t.long lj_err_unwind_dwarf-.\n" |
2353 | "\t.byte 0x1b\n" /* pcrel|sdata4 */ | 2373 | "\t.byte 0x1b\n" /* pcrel|sdata4 */ |
2354 | "\t.byte 0xc\n\t.uleb128 0x4\n\t.uleb128 0x4\n" | 2374 | "\t.byte 0xc\n\t.uleb128 " REG_SP "\n\t.uleb128 " SZPTR "\n" |
2355 | "\t.byte 0x88\n\t.uleb128 0x1\n" | 2375 | "\t.byte 0x80+" REG_RA "\n\t.uleb128 0x1\n" |
2356 | "\t.align 4\n" | 2376 | "\t.align " SZPTR "\n" |
2357 | ".LECIE1:\n\n"); | 2377 | ".LECIE1:\n\n"); |
2358 | fprintf(ctx->fp, | 2378 | fprintf(ctx->fp, |
2359 | ".LSFDE1:\n" | 2379 | ".LSFDE1:\n" |
@@ -2363,13 +2383,22 @@ static void emit_asm_debug(BuildCtx *ctx) | |||
2363 | "\t.long .Lbegin-.\n" | 2383 | "\t.long .Lbegin-.\n" |
2364 | "\t.long %d\n" | 2384 | "\t.long %d\n" |
2365 | "\t.uleb128 0\n" /* augmentation length */ | 2385 | "\t.uleb128 0\n" /* augmentation length */ |
2366 | "\t.byte 0xe\n\t.uleb128 0x30\n" /* def_cfa_offset */ | 2386 | "\t.byte 0xe\n\t.uleb128 %d\n" /* def_cfa_offset */ |
2387 | #if LJ_64 | ||
2388 | "\t.byte 0x86\n\t.uleb128 0x2\n" /* offset rbp */ | ||
2389 | "\t.byte 0x83\n\t.uleb128 0x3\n" /* offset rbx */ | ||
2390 | "\t.byte 0x8f\n\t.uleb128 0x4\n" /* offset r15 */ | ||
2391 | "\t.byte 0x8e\n\t.uleb128 0x5\n" /* offset r14 */ | ||
2392 | "\t.byte 0x8d\n\t.uleb128 0x6\n" /* offset r13 */ | ||
2393 | "\t.byte 0x8c\n\t.uleb128 0x7\n" /* offset r12 */ | ||
2394 | #else | ||
2367 | "\t.byte 0x85\n\t.uleb128 0x2\n" /* offset ebp */ | 2395 | "\t.byte 0x85\n\t.uleb128 0x2\n" /* offset ebp */ |
2368 | "\t.byte 0x87\n\t.uleb128 0x3\n" /* offset edi */ | 2396 | "\t.byte 0x87\n\t.uleb128 0x3\n" /* offset edi */ |
2369 | "\t.byte 0x86\n\t.uleb128 0x4\n" /* offset esi */ | 2397 | "\t.byte 0x86\n\t.uleb128 0x4\n" /* offset esi */ |
2370 | "\t.byte 0x83\n\t.uleb128 0x5\n" /* offset ebx */ | 2398 | "\t.byte 0x83\n\t.uleb128 0x5\n" /* offset ebx */ |
2371 | "\t.align 4\n" | 2399 | #endif |
2372 | ".LEFDE1:\n\n", (int)ctx->codesz); | 2400 | "\t.align " SZPTR "\n" |
2401 | ".LEFDE1:\n\n", (int)ctx->codesz, CFRAME_SIZE); | ||
2373 | break; | 2402 | break; |
2374 | case BUILD_machasm: | 2403 | case BUILD_machasm: |
2375 | fprintf(ctx->fp, "\t.section __TEXT,__eh_frame,coalesced,no_toc+strip_static_syms+live_support\n"); | 2404 | fprintf(ctx->fp, "\t.section __TEXT,__eh_frame,coalesced,no_toc+strip_static_syms+live_support\n"); |
@@ -2382,15 +2411,19 @@ static void emit_asm_debug(BuildCtx *ctx) | |||
2382 | "\t.byte 0x1\n" | 2411 | "\t.byte 0x1\n" |
2383 | "\t.ascii \"zPR\\0\"\n" | 2412 | "\t.ascii \"zPR\\0\"\n" |
2384 | "\t.byte 0x1\n" | 2413 | "\t.byte 0x1\n" |
2385 | "\t.byte 128-4\n" | 2414 | "\t.byte 128-" SZPTR "\n" |
2386 | "\t.byte 0x8\n" | 2415 | "\t.byte " REG_RA "\n" |
2387 | "\t.byte 6\n" /* augmentation length */ | 2416 | "\t.byte 6\n" /* augmentation length */ |
2388 | "\t.byte 0x9b\n" /* indirect|pcrel|sdata4 */ | 2417 | "\t.byte 0x9b\n" /* indirect|pcrel|sdata4 */ |
2389 | "\t.long L_lj_err_unwind_dwarf$non_lazy_ptr-.\n" | 2418 | "\t.long L_lj_err_unwind_dwarf$non_lazy_ptr-.\n" |
2390 | "\t.byte 0x1b\n" /* pcrel|sdata4 */ | 2419 | "\t.byte 0x1b\n" /* pcrel|sdata4 */ |
2420 | #if LJ_64 | ||
2421 | "\t.byte 0xc\n\t.byte " REG_SP "\n\t.byte " SZPTR "\n" | ||
2422 | #else | ||
2391 | "\t.byte 0xc\n\t.byte 0x5\n\t.byte 0x4\n" /* esp=5 on 32 bit MACH-O. */ | 2423 | "\t.byte 0xc\n\t.byte 0x5\n\t.byte 0x4\n" /* esp=5 on 32 bit MACH-O. */ |
2392 | "\t.byte 0x88\n\t.byte 0x1\n" | 2424 | #endif |
2393 | "\t.align 2\n" | 2425 | "\t.byte 0x80+" REG_RA "\n\t.byte 0x1\n" |
2426 | "\t.align " BSZPTR "\n" | ||
2394 | "LECIE1:\n\n"); | 2427 | "LECIE1:\n\n"); |
2395 | fprintf(ctx->fp, | 2428 | fprintf(ctx->fp, |
2396 | "_lj_vm_asm_begin.eh:\n" | 2429 | "_lj_vm_asm_begin.eh:\n" |
@@ -2402,13 +2435,22 @@ static void emit_asm_debug(BuildCtx *ctx) | |||
2402 | "\t.long _lj_vm_asm_begin-.\n" | 2435 | "\t.long _lj_vm_asm_begin-.\n" |
2403 | "\t.long %d\n" | 2436 | "\t.long %d\n" |
2404 | "\t.byte 0\n" /* augmentation length */ | 2437 | "\t.byte 0\n" /* augmentation length */ |
2405 | "\t.byte 0xe\n\t.byte 0x30\n" /* def_cfa_offset */ | 2438 | "\t.byte 0xe\n\t.byte %d\n" /* def_cfa_offset */ |
2439 | #if LJ_64 | ||
2440 | "\t.byte 0x86\n\t.uleb128 0x2\n" /* offset rbp */ | ||
2441 | "\t.byte 0x83\n\t.uleb128 0x3\n" /* offset rbx */ | ||
2442 | "\t.byte 0x8f\n\t.uleb128 0x4\n" /* offset r15 */ | ||
2443 | "\t.byte 0x8e\n\t.uleb128 0x5\n" /* offset r14 */ | ||
2444 | "\t.byte 0x8d\n\t.uleb128 0x6\n" /* offset r13 */ | ||
2445 | "\t.byte 0x8c\n\t.uleb128 0x7\n" /* offset r12 */ | ||
2446 | #else | ||
2406 | "\t.byte 0x84\n\t.byte 0x2\n" /* offset ebp (4 for MACH-O)*/ | 2447 | "\t.byte 0x84\n\t.byte 0x2\n" /* offset ebp (4 for MACH-O)*/ |
2407 | "\t.byte 0x87\n\t.byte 0x3\n" /* offset edi */ | 2448 | "\t.byte 0x87\n\t.byte 0x3\n" /* offset edi */ |
2408 | "\t.byte 0x86\n\t.byte 0x4\n" /* offset esi */ | 2449 | "\t.byte 0x86\n\t.byte 0x4\n" /* offset esi */ |
2409 | "\t.byte 0x83\n\t.byte 0x5\n" /* offset ebx */ | 2450 | "\t.byte 0x83\n\t.byte 0x5\n" /* offset ebx */ |
2410 | "\t.align 2\n" | 2451 | #endif |
2411 | "LEFDE1:\n\n", (int)ctx->codesz); | 2452 | "\t.align " BSZPTR "\n" |
2453 | "LEFDE1:\n\n", (int)ctx->codesz, CFRAME_SIZE); | ||
2412 | fprintf(ctx->fp, | 2454 | fprintf(ctx->fp, |
2413 | "\t.non_lazy_symbol_pointer\n" | 2455 | "\t.non_lazy_symbol_pointer\n" |
2414 | "L_lj_err_unwind_dwarf$non_lazy_ptr:\n" | 2456 | "L_lj_err_unwind_dwarf$non_lazy_ptr:\n" |