diff options
author | Mike Pall <mike> | 2021-10-17 13:14:41 +0200 |
---|---|---|
committer | Mike Pall <mike> | 2021-10-17 13:14:41 +0200 |
commit | bfcb74ed36d733bae249fe7642b7324a56be88d0 (patch) | |
tree | c01147765f5727f1534ff60974468e72445f496e | |
parent | bfd076532cdf1159df13499392879f5f4d3a9a5d (diff) | |
download | luajit-bfcb74ed36d733bae249fe7642b7324a56be88d0.tar.gz luajit-bfcb74ed36d733bae249fe7642b7324a56be88d0.tar.bz2 luajit-bfcb74ed36d733bae249fe7642b7324a56be88d0.zip |
OSX/ARM64: Fix external unwinding.
Contributed by Edmund Kapusniak. #698 #757
-rw-r--r-- | src/Makefile | 5 | ||||
-rw-r--r-- | src/vm_arm64.dasc | 89 |
2 files changed, 40 insertions, 54 deletions
diff --git a/src/Makefile b/src/Makefile index 4650c3e0..2538503f 100644 --- a/src/Makefile +++ b/src/Makefile | |||
@@ -320,10 +320,7 @@ ifeq (Darwin,$(TARGET_SYS)) | |||
320 | $(error missing: export MACOSX_DEPLOYMENT_TARGET=XX.YY) | 320 | $(error missing: export MACOSX_DEPLOYMENT_TARGET=XX.YY) |
321 | endif | 321 | endif |
322 | TARGET_STRIP+= -x | 322 | TARGET_STRIP+= -x |
323 | # Ext. unwinding is broken on OSX/ARM64 until someone finds a fix. See #698. | 323 | TARGET_XCFLAGS+= -DLUAJIT_UNWIND_EXTERNAL |
324 | ifneq (arm64,$(TARGET_LJARCH)) | ||
325 | TARGET_XCFLAGS+= -DLUAJIT_UNWIND_EXTERNAL | ||
326 | endif | ||
327 | TARGET_XSHLDFLAGS= -dynamiclib -single_module -undefined dynamic_lookup -fPIC | 324 | TARGET_XSHLDFLAGS= -dynamiclib -single_module -undefined dynamic_lookup -fPIC |
328 | TARGET_DYNXLDOPTS= | 325 | TARGET_DYNXLDOPTS= |
329 | TARGET_XSHLDFLAGS+= -install_name $(TARGET_DYLIBPATH) -compatibility_version $(MAJVER).$(MINVER) -current_version $(MAJVER).$(MINVER).$(RELVER) | 326 | TARGET_XSHLDFLAGS+= -install_name $(TARGET_DYLIBPATH) -compatibility_version $(MAJVER).$(MINVER) -current_version $(MAJVER).$(MINVER).$(RELVER) |
diff --git a/src/vm_arm64.dasc b/src/vm_arm64.dasc index 4dac97c3..c7090ca3 100644 --- a/src/vm_arm64.dasc +++ b/src/vm_arm64.dasc | |||
@@ -81,8 +81,7 @@ | |||
81 | | | 81 | | |
82 | |.define CFRAME_SPACE, 208 | 82 | |.define CFRAME_SPACE, 208 |
83 | |//----- 16 byte aligned, <-- sp entering interpreter | 83 | |//----- 16 byte aligned, <-- sp entering interpreter |
84 | |.define SAVE_LR, [sp, #200] | 84 | |.define SAVE_FP_LR_, 192 |
85 | |.define SAVE_FP, [sp, #192] | ||
86 | |.define SAVE_GPR_, 112 // 112+10*8: 64 bit GPR saves | 85 | |.define SAVE_GPR_, 112 // 112+10*8: 64 bit GPR saves |
87 | |.define SAVE_FPR_, 48 // 48+8*8: 64 bit FPR saves | 86 | |.define SAVE_FPR_, 48 // 48+8*8: 64 bit FPR saves |
88 | |// Unused [sp, #44] // 32 bit values | 87 | |// Unused [sp, #44] // 32 bit values |
@@ -108,8 +107,8 @@ | |||
108 | | | 107 | | |
109 | |.macro saveregs | 108 | |.macro saveregs |
110 | | sub sp, sp, # CFRAME_SPACE | 109 | | sub sp, sp, # CFRAME_SPACE |
111 | | stp fp, lr, SAVE_FP | 110 | | stp fp, lr, [sp, # SAVE_FP_LR_] |
112 | | add fp, sp, #0 | 111 | | add fp, sp, # SAVE_FP_LR_ |
113 | | stp x20, x19, [sp, # SAVE_GPR_+(27-19)*8] | 112 | | stp x20, x19, [sp, # SAVE_GPR_+(27-19)*8] |
114 | | save_ 21, 22, 8, 9 | 113 | | save_ 21, 22, 8, 9 |
115 | | save_ 23, 24, 10, 11 | 114 | | save_ 23, 24, 10, 11 |
@@ -122,7 +121,7 @@ | |||
122 | | rest_ 23, 24, 10, 11 | 121 | | rest_ 23, 24, 10, 11 |
123 | | rest_ 25, 26, 12, 13 | 122 | | rest_ 25, 26, 12, 13 |
124 | | rest_ 27, 28, 14, 15 | 123 | | rest_ 27, 28, 14, 15 |
125 | | ldp fp, lr, SAVE_FP | 124 | | ldp fp, lr, [sp, # SAVE_FP_LR_] |
126 | | add sp, sp, # CFRAME_SPACE | 125 | | add sp, sp, # CFRAME_SPACE |
127 | |.endmacro | 126 | |.endmacro |
128 | | | 127 | | |
@@ -502,8 +501,9 @@ static void build_subroutines(BuildCtx *ctx) | |||
502 | | ldr GL, L->glref // Setup pointer to global state. | 501 | | ldr GL, L->glref // Setup pointer to global state. |
503 | | mov BASE, CARG2 | 502 | | mov BASE, CARG2 |
504 | | str CARG1, SAVE_PC // Any value outside of bytecode is ok. | 503 | | str CARG1, SAVE_PC // Any value outside of bytecode is ok. |
505 | | str RC, SAVE_CFRAME | 504 | | add TMP0, sp, #0 |
506 | | str fp, L->cframe // Add our C frame to cframe chain. | 505 | | str RC, SAVE_CFRAME |
506 | | str TMP0, L->cframe // Add our C frame to cframe chain. | ||
507 | | | 507 | | |
508 | |3: // Entry point for vm_cpcall/vm_resume (BASE = base, PC = ftype). | 508 | |3: // Entry point for vm_cpcall/vm_resume (BASE = base, PC = ftype). |
509 | | str L, GL->cur_L | 509 | | str L, GL->cur_L |
@@ -538,8 +538,9 @@ static void build_subroutines(BuildCtx *ctx) | |||
538 | | sub RA, RA, RB // Compute -savestack(L, L->top). | 538 | | sub RA, RA, RB // Compute -savestack(L, L->top). |
539 | | str RAw, SAVE_NRES // Neg. delta means cframe w/o frame. | 539 | | str RAw, SAVE_NRES // Neg. delta means cframe w/o frame. |
540 | | str wzr, SAVE_ERRF // No error function. | 540 | | str wzr, SAVE_ERRF // No error function. |
541 | | str RC, SAVE_CFRAME | 541 | | add TMP0, sp, #0 |
542 | | str fp, L->cframe // Add our C frame to cframe chain. | 542 | | str RC, SAVE_CFRAME |
543 | | str TMP0, L->cframe // Add our C frame to cframe chain. | ||
543 | | str L, GL->cur_L | 544 | | str L, GL->cur_L |
544 | | blr CARG4 // (lua_State *L, lua_CFunction func, void *ud) | 545 | | blr CARG4 // (lua_State *L, lua_CFunction func, void *ud) |
545 | | mov BASE, CRET1 | 546 | | mov BASE, CRET1 |
@@ -2182,14 +2183,14 @@ static void build_subroutines(BuildCtx *ctx) | |||
2182 | | .type CCSTATE, CCallState, x19 | 2183 | | .type CCSTATE, CCallState, x19 |
2183 | | stp x20, CCSTATE, [sp, #-32]! | 2184 | | stp x20, CCSTATE, [sp, #-32]! |
2184 | | stp fp, lr, [sp, #16] | 2185 | | stp fp, lr, [sp, #16] |
2185 | | add fp, sp, #0 | 2186 | | add fp, sp, #16 |
2186 | | mov CCSTATE, x0 | 2187 | | mov CCSTATE, x0 |
2187 | | ldr TMP0w, CCSTATE:x0->spadj | 2188 | | ldr TMP0w, CCSTATE:x0->spadj |
2188 | | ldrb TMP1w, CCSTATE->nsp | 2189 | | ldrb TMP1w, CCSTATE->nsp |
2189 | | add TMP2, CCSTATE, #offsetof(CCallState, stack) | 2190 | | add TMP2, CCSTATE, #offsetof(CCallState, stack) |
2190 | | subs TMP1, TMP1, #1 | 2191 | | subs TMP1, TMP1, #1 |
2191 | | ldr TMP3, CCSTATE->func | 2192 | | ldr TMP3, CCSTATE->func |
2192 | | sub sp, fp, TMP0 | 2193 | | sub sp, sp, TMP0 |
2193 | | bmi >2 | 2194 | | bmi >2 |
2194 | |1: // Copy stack slots | 2195 | |1: // Copy stack slots |
2195 | | ldr TMP0, [TMP2, TMP1, lsl #3] | 2196 | | ldr TMP0, [TMP2, TMP1, lsl #3] |
@@ -2207,7 +2208,7 @@ static void build_subroutines(BuildCtx *ctx) | |||
2207 | | ldp d6, d7, CCSTATE->fpr[6] | 2208 | | ldp d6, d7, CCSTATE->fpr[6] |
2208 | | ldr x8, CCSTATE->retp | 2209 | | ldr x8, CCSTATE->retp |
2209 | | blr TMP3 | 2210 | | blr TMP3 |
2210 | | mov sp, fp | 2211 | | sub sp, fp, #16 |
2211 | | stp x0, x1, CCSTATE->gpr[0] | 2212 | | stp x0, x1, CCSTATE->gpr[0] |
2212 | | stp d0, d1, CCSTATE->fpr[0] | 2213 | | stp d0, d1, CCSTATE->fpr[0] |
2213 | | stp d2, d3, CCSTATE->fpr[2] | 2214 | | stp d2, d3, CCSTATE->fpr[2] |
@@ -3950,7 +3951,7 @@ static void emit_asm_debug(BuildCtx *ctx) | |||
3950 | "\t.uleb128 0x1\n" | 3951 | "\t.uleb128 0x1\n" |
3951 | "\t.sleb128 -8\n" | 3952 | "\t.sleb128 -8\n" |
3952 | "\t.byte 30\n" /* Return address is in lr. */ | 3953 | "\t.byte 30\n" /* Return address is in lr. */ |
3953 | "\t.byte 0xc\n\t.uleb128 31\n\t.uleb128 0\n" /* def_cfa sp */ | 3954 | "\t.byte 0xc\n\t.uleb128 29\n\t.uleb128 16\n" /* def_cfa fp 16 */ |
3954 | "\t.align 3\n" | 3955 | "\t.align 3\n" |
3955 | ".LECIE0:\n\n"); | 3956 | ".LECIE0:\n\n"); |
3956 | fprintf(ctx->fp, | 3957 | fprintf(ctx->fp, |
@@ -3960,10 +3961,9 @@ static void emit_asm_debug(BuildCtx *ctx) | |||
3960 | "\t.long .Lframe0\n" | 3961 | "\t.long .Lframe0\n" |
3961 | "\t.quad .Lbegin\n" | 3962 | "\t.quad .Lbegin\n" |
3962 | "\t.quad %d\n" | 3963 | "\t.quad %d\n" |
3963 | "\t.byte 0xe\n\t.uleb128 %d\n" /* def_cfa_offset */ | ||
3964 | "\t.byte 0x9e\n\t.uleb128 1\n" /* offset lr */ | 3964 | "\t.byte 0x9e\n\t.uleb128 1\n" /* offset lr */ |
3965 | "\t.byte 0x9d\n\t.uleb128 2\n", /* offset fp */ | 3965 | "\t.byte 0x9d\n\t.uleb128 2\n", /* offset fp */ |
3966 | fcofs, CFRAME_SIZE); | 3966 | fcofs); |
3967 | for (i = 19; i <= 28; i++) /* offset x19-x28 */ | 3967 | for (i = 19; i <= 28; i++) /* offset x19-x28 */ |
3968 | fprintf(ctx->fp, "\t.byte 0x%x\n\t.uleb128 %d\n", 0x80+i, i+(3-19)); | 3968 | fprintf(ctx->fp, "\t.byte 0x%x\n\t.uleb128 %d\n", 0x80+i, i+(3-19)); |
3969 | for (i = 8; i <= 15; i++) /* offset d8-d15 */ | 3969 | for (i = 8; i <= 15; i++) /* offset d8-d15 */ |
@@ -3980,12 +3980,10 @@ static void emit_asm_debug(BuildCtx *ctx) | |||
3980 | "\t.long .Lframe0\n" | 3980 | "\t.long .Lframe0\n" |
3981 | "\t.quad lj_vm_ffi_call\n" | 3981 | "\t.quad lj_vm_ffi_call\n" |
3982 | "\t.quad %d\n" | 3982 | "\t.quad %d\n" |
3983 | "\t.byte 0xe\n\t.uleb128 32\n" /* def_cfa_offset */ | ||
3984 | "\t.byte 0x9e\n\t.uleb128 1\n" /* offset lr */ | 3983 | "\t.byte 0x9e\n\t.uleb128 1\n" /* offset lr */ |
3985 | "\t.byte 0x9d\n\t.uleb128 2\n" /* offset fp */ | 3984 | "\t.byte 0x9d\n\t.uleb128 2\n" /* offset fp */ |
3986 | "\t.byte 0x93\n\t.uleb128 3\n" /* offset x19 */ | 3985 | "\t.byte 0x93\n\t.uleb128 3\n" /* offset x19 */ |
3987 | "\t.byte 0x94\n\t.uleb128 4\n" /* offset x20 */ | 3986 | "\t.byte 0x94\n\t.uleb128 4\n" /* offset x20 */ |
3988 | "\t.byte 0xd\n\t.uleb128 0x1d\n" /* def_cfa_register fp */ | ||
3989 | "\t.align 3\n" | 3987 | "\t.align 3\n" |
3990 | ".LEFDE1:\n\n", (int)ctx->codesz - fcofs); | 3988 | ".LEFDE1:\n\n", (int)ctx->codesz - fcofs); |
3991 | #endif | 3989 | #endif |
@@ -4004,7 +4002,7 @@ static void emit_asm_debug(BuildCtx *ctx) | |||
4004 | "\t.byte 0x1b\n" /* pcrel|sdata4 */ | 4002 | "\t.byte 0x1b\n" /* pcrel|sdata4 */ |
4005 | "\t.long lj_err_unwind_dwarf-.\n" | 4003 | "\t.long lj_err_unwind_dwarf-.\n" |
4006 | "\t.byte 0x1b\n" /* pcrel|sdata4 */ | 4004 | "\t.byte 0x1b\n" /* pcrel|sdata4 */ |
4007 | "\t.byte 0xc\n\t.uleb128 31\n\t.uleb128 0\n" /* def_cfa sp */ | 4005 | "\t.byte 0xc\n\t.uleb128 29\n\t.uleb128 16\n" /* def_cfa fp 16 */ |
4008 | "\t.align 3\n" | 4006 | "\t.align 3\n" |
4009 | ".LECIE1:\n\n"); | 4007 | ".LECIE1:\n\n"); |
4010 | fprintf(ctx->fp, | 4008 | fprintf(ctx->fp, |
@@ -4015,10 +4013,9 @@ static void emit_asm_debug(BuildCtx *ctx) | |||
4015 | "\t.long .Lbegin-.\n" | 4013 | "\t.long .Lbegin-.\n" |
4016 | "\t.long %d\n" | 4014 | "\t.long %d\n" |
4017 | "\t.uleb128 0\n" /* augmentation length */ | 4015 | "\t.uleb128 0\n" /* augmentation length */ |
4018 | "\t.byte 0xe\n\t.uleb128 %d\n" /* def_cfa_offset */ | ||
4019 | "\t.byte 0x9e\n\t.uleb128 1\n" /* offset lr */ | 4016 | "\t.byte 0x9e\n\t.uleb128 1\n" /* offset lr */ |
4020 | "\t.byte 0x9d\n\t.uleb128 2\n", /* offset fp */ | 4017 | "\t.byte 0x9d\n\t.uleb128 2\n", /* offset fp */ |
4021 | fcofs, CFRAME_SIZE); | 4018 | fcofs); |
4022 | for (i = 19; i <= 28; i++) /* offset x19-x28 */ | 4019 | for (i = 19; i <= 28; i++) /* offset x19-x28 */ |
4023 | fprintf(ctx->fp, "\t.byte 0x%x\n\t.uleb128 %d\n", 0x80+i, i+(3-19)); | 4020 | fprintf(ctx->fp, "\t.byte 0x%x\n\t.uleb128 %d\n", 0x80+i, i+(3-19)); |
4024 | for (i = 8; i <= 15; i++) /* offset d8-d15 */ | 4021 | for (i = 8; i <= 15; i++) /* offset d8-d15 */ |
@@ -4040,7 +4037,7 @@ static void emit_asm_debug(BuildCtx *ctx) | |||
4040 | "\t.byte 30\n" /* Return address is in lr. */ | 4037 | "\t.byte 30\n" /* Return address is in lr. */ |
4041 | "\t.uleb128 1\n" /* augmentation length */ | 4038 | "\t.uleb128 1\n" /* augmentation length */ |
4042 | "\t.byte 0x1b\n" /* pcrel|sdata4 */ | 4039 | "\t.byte 0x1b\n" /* pcrel|sdata4 */ |
4043 | "\t.byte 0xc\n\t.uleb128 31\n\t.uleb128 0\n" /* def_cfa sp */ | 4040 | "\t.byte 0xc\n\t.uleb128 29\n\t.uleb128 16\n" /* def_cfa fp 16 */ |
4044 | "\t.align 3\n" | 4041 | "\t.align 3\n" |
4045 | ".LECIE2:\n\n"); | 4042 | ".LECIE2:\n\n"); |
4046 | fprintf(ctx->fp, | 4043 | fprintf(ctx->fp, |
@@ -4051,18 +4048,15 @@ static void emit_asm_debug(BuildCtx *ctx) | |||
4051 | "\t.long lj_vm_ffi_call-.\n" | 4048 | "\t.long lj_vm_ffi_call-.\n" |
4052 | "\t.long %d\n" | 4049 | "\t.long %d\n" |
4053 | "\t.uleb128 0\n" /* augmentation length */ | 4050 | "\t.uleb128 0\n" /* augmentation length */ |
4054 | "\t.byte 0xe\n\t.uleb128 32\n" /* def_cfa_offset */ | ||
4055 | "\t.byte 0x9e\n\t.uleb128 1\n" /* offset lr */ | 4051 | "\t.byte 0x9e\n\t.uleb128 1\n" /* offset lr */ |
4056 | "\t.byte 0x9d\n\t.uleb128 2\n" /* offset fp */ | 4052 | "\t.byte 0x9d\n\t.uleb128 2\n" /* offset fp */ |
4057 | "\t.byte 0x93\n\t.uleb128 3\n" /* offset x19 */ | 4053 | "\t.byte 0x93\n\t.uleb128 3\n" /* offset x19 */ |
4058 | "\t.byte 0x94\n\t.uleb128 4\n" /* offset x20 */ | 4054 | "\t.byte 0x94\n\t.uleb128 4\n" /* offset x20 */ |
4059 | "\t.byte 0xd\n\t.uleb128 0x1d\n" /* def_cfa_register fp */ | ||
4060 | "\t.align 3\n" | 4055 | "\t.align 3\n" |
4061 | ".LEFDE3:\n\n", (int)ctx->codesz - fcofs); | 4056 | ".LEFDE3:\n\n", (int)ctx->codesz - fcofs); |
4062 | #endif | 4057 | #endif |
4063 | break; | 4058 | break; |
4064 | /* Disabled until someone finds a fix. See #698. */ | 4059 | #if !LJ_NO_UNWIND |
4065 | #if !LJ_NO_UNWIND && 0 | ||
4066 | case BUILD_machasm: { | 4060 | case BUILD_machasm: { |
4067 | #if LJ_HASFFI | 4061 | #if LJ_HASFFI |
4068 | int fcsize = 0; | 4062 | int fcsize = 0; |
@@ -4077,14 +4071,14 @@ static void emit_asm_debug(BuildCtx *ctx) | |||
4077 | "\t.long 0\n" | 4071 | "\t.long 0\n" |
4078 | "\t.byte 0x1\n" | 4072 | "\t.byte 0x1\n" |
4079 | "\t.ascii \"zPR\\0\"\n" | 4073 | "\t.ascii \"zPR\\0\"\n" |
4080 | "\t.byte 0x1\n" | 4074 | "\t.uleb128 0x1\n" |
4081 | "\t.byte 128-8\n" | 4075 | "\t.sleb128 -8\n" |
4082 | "\t.byte 30\n" /* Return address is in lr. */ | 4076 | "\t.byte 30\n" /* Return address is in lr. */ |
4083 | "\t.byte 6\n" /* augmentation length */ | 4077 | "\t.uleb128 6\n" /* augmentation length */ |
4084 | "\t.byte 0x9b\n" /* indirect|pcrel|sdata4 */ | 4078 | "\t.byte 0x9b\n" /* indirect|pcrel|sdata4 */ |
4085 | "\t.long _lj_err_unwind_dwarf@GOTPCREL\n" | 4079 | "\t.long _lj_err_unwind_dwarf@GOT-.\n" |
4086 | "\t.byte 0x1b\n" /* pcrel|sdata4 */ | 4080 | "\t.byte 0x1b\n" /* pcrel|sdata4 */ |
4087 | "\t.byte 0xc\n\t.byte 31\n\t.byte 0\n" /* def_cfa sp */ | 4081 | "\t.byte 0xc\n\t.uleb128 29\n\t.uleb128 16\n" /* def_cfa fp 16 */ |
4088 | "\t.align 3\n" | 4082 | "\t.align 3\n" |
4089 | "LECIEX:\n\n"); | 4083 | "LECIEX:\n\n"); |
4090 | for (j = 0; j < ctx->nsym; j++) { | 4084 | for (j = 0; j < ctx->nsym; j++) { |
@@ -4095,7 +4089,6 @@ static void emit_asm_debug(BuildCtx *ctx) | |||
4095 | if (!strcmp(name, "_lj_vm_ffi_call")) { fcsize = size; continue; } | 4089 | if (!strcmp(name, "_lj_vm_ffi_call")) { fcsize = size; continue; } |
4096 | #endif | 4090 | #endif |
4097 | fprintf(ctx->fp, | 4091 | fprintf(ctx->fp, |
4098 | "%s.eh:\n" | ||
4099 | "LSFDE%d:\n" | 4092 | "LSFDE%d:\n" |
4100 | "\t.set L$set$%d,LEFDE%d-LASFDE%d\n" | 4093 | "\t.set L$set$%d,LEFDE%d-LASFDE%d\n" |
4101 | "\t.long L$set$%d\n" | 4094 | "\t.long L$set$%d\n" |
@@ -4103,15 +4096,14 @@ static void emit_asm_debug(BuildCtx *ctx) | |||
4103 | "\t.long LASFDE%d-EH_frame1\n" | 4096 | "\t.long LASFDE%d-EH_frame1\n" |
4104 | "\t.long %s-.\n" | 4097 | "\t.long %s-.\n" |
4105 | "\t.long %d\n" | 4098 | "\t.long %d\n" |
4106 | "\t.byte 0\n" /* augmentation length */ | 4099 | "\t.uleb128 0\n" /* augmentation length */ |
4107 | "\t.byte 0xe\n\t.byte %d\n\t.byte 1\n" /* def_cfa_offset */ | 4100 | "\t.byte 0x9e\n\t.uleb128 1\n" /* offset lr */ |
4108 | "\t.byte 0x9e\n\t.byte 1\n" /* offset lr */ | 4101 | "\t.byte 0x9d\n\t.uleb128 2\n", /* offset fp */ |
4109 | "\t.byte 0x9d\n\t.byte 2\n", /* offset fp */ | 4102 | j, j, j, j, j, j, j, name, size); |
4110 | name, j, j, j, j, j, j, j, name, size, CFRAME_SIZE); | ||
4111 | for (i = 19; i <= 28; i++) /* offset x19-x28 */ | 4103 | for (i = 19; i <= 28; i++) /* offset x19-x28 */ |
4112 | fprintf(ctx->fp, "\t.byte 0x%x\n\t.byte %d\n", 0x80+i, i+(3-19)); | 4104 | fprintf(ctx->fp, "\t.byte 0x%x\n\t.uleb128 %d\n", 0x80+i, i+(3-19)); |
4113 | for (i = 8; i <= 15; i++) /* offset d8-d15 */ | 4105 | for (i = 8; i <= 15; i++) /* offset d8-d15 */ |
4114 | fprintf(ctx->fp, "\t.byte 5\n\t.byte 0x%x\n\t.byte %d\n", | 4106 | fprintf(ctx->fp, "\t.byte 5\n\t.uleb128 0x%x\n\t.uleb128 %d\n", |
4115 | 64+i, i+(3+(28-19+1)-8)); | 4107 | 64+i, i+(3+(28-19+1)-8)); |
4116 | fprintf(ctx->fp, | 4108 | fprintf(ctx->fp, |
4117 | "\t.align 3\n" | 4109 | "\t.align 3\n" |
@@ -4127,16 +4119,15 @@ static void emit_asm_debug(BuildCtx *ctx) | |||
4127 | "\t.long 0\n" | 4119 | "\t.long 0\n" |
4128 | "\t.byte 0x1\n" | 4120 | "\t.byte 0x1\n" |
4129 | "\t.ascii \"zR\\0\"\n" | 4121 | "\t.ascii \"zR\\0\"\n" |
4130 | "\t.byte 0x1\n" | 4122 | "\t.uleb128 0x1\n" |
4131 | "\t.byte 128-8\n" | 4123 | "\t.sleb128 -8\n" |
4132 | "\t.byte 30\n" /* Return address is in lr. */ | 4124 | "\t.byte 30\n" /* Return address is in lr. */ |
4133 | "\t.byte 1\n" /* augmentation length */ | 4125 | "\t.uleb128 1\n" /* augmentation length */ |
4134 | "\t.byte 0x1b\n" /* pcrel|sdata4 */ | 4126 | "\t.byte 0x1b\n" /* pcrel|sdata4 */ |
4135 | "\t.byte 0xc\n\t.byte 31\n\t.byte 0\n" /* def_cfa sp */ | 4127 | "\t.byte 0xc\n\t.uleb128 29\n\t.uleb128 16\n" /* def_cfa fp 16 */ |
4136 | "\t.align 3\n" | 4128 | "\t.align 3\n" |
4137 | "LECIEY:\n\n"); | 4129 | "LECIEY:\n\n"); |
4138 | fprintf(ctx->fp, | 4130 | fprintf(ctx->fp, |
4139 | "_lj_vm_ffi_call.eh:\n" | ||
4140 | "LSFDEY:\n" | 4131 | "LSFDEY:\n" |
4141 | "\t.set L$set$yy,LEFDEY-LASFDEY\n" | 4132 | "\t.set L$set$yy,LEFDEY-LASFDEY\n" |
4142 | "\t.long L$set$yy\n" | 4133 | "\t.long L$set$yy\n" |
@@ -4144,13 +4135,11 @@ static void emit_asm_debug(BuildCtx *ctx) | |||
4144 | "\t.long LASFDEY-EH_frame2\n" | 4135 | "\t.long LASFDEY-EH_frame2\n" |
4145 | "\t.long _lj_vm_ffi_call-.\n" | 4136 | "\t.long _lj_vm_ffi_call-.\n" |
4146 | "\t.long %d\n" | 4137 | "\t.long %d\n" |
4147 | "\t.byte 0\n" /* augmentation length */ | 4138 | "\t.uleb128 0\n" /* augmentation length */ |
4148 | "\t.byte 0xe\n\t.byte 32\n" /* def_cfa_offset */ | 4139 | "\t.byte 0x9e\n\t.uleb128 1\n" /* offset lr */ |
4149 | "\t.byte 0x9e\n\t.byte 1\n" /* offset lr */ | 4140 | "\t.byte 0x9d\n\t.uleb128 2\n" /* offset fp */ |
4150 | "\t.byte 0x9d\n\t.byte 2\n" /* offset fp */ | 4141 | "\t.byte 0x93\n\t.uleb128 3\n" /* offset x19 */ |
4151 | "\t.byte 0x93\n\t.byte 3\n" /* offset x19 */ | 4142 | "\t.byte 0x94\n\t.uleb128 4\n" /* offset x20 */ |
4152 | "\t.byte 0x94\n\t.byte 4\n" /* offset x20 */ | ||
4153 | "\t.byte 0xd\n\t.uleb128 0x1d\n" /* def_cfa_register fp */ | ||
4154 | "\t.align 3\n" | 4143 | "\t.align 3\n" |
4155 | "LEFDEY:\n\n", fcsize); | 4144 | "LEFDEY:\n\n", fcsize); |
4156 | } | 4145 | } |