From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from [87.239.111.99] (localhost [127.0.0.1]) by dev.tarantool.org (Postfix) with ESMTP id 0C50118EFEC; Tue, 6 Dec 2022 00:42:29 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 0C50118EFEC DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1670276549; bh=a83F5Dmdkm6v6MZ/dXDjMNm6wG1uPys+BECmEM2XZI8=; h=In-Reply-To:Date:References:To:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=ppY6MSO0fV4/+yW1Ltm4IqBuxVzTXVAs1ZirRKcEc+BzkxYpnCYyIhD8o5eLwLKgF j1jXzqIbNHy1oG5OdkpZh8YZoI6T1Kl0yfWpRlt+41RQ0i7cN+H0aCAWioPUBk0x9v oqixoXSGsj+AwIVAXRAVZRsPgRQ8bgs+4Vd24E0M= Received: from smtp16.i.mail.ru (smtp16.i.mail.ru [95.163.41.69]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 23A127036F for ; Tue, 6 Dec 2022 00:42:28 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 23A127036F Received: by smtp16.i.mail.ru with esmtpa (envelope-from ) id 1p2JEJ-00DcKM-11; Tue, 06 Dec 2022 00:42:27 +0300 Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3731.200.110.1.12\)) In-Reply-To: <20221028092638.11506-5-max.kokryashkin@gmail.com> Date: Tue, 6 Dec 2022 00:42:16 +0300 Content-Transfer-Encoding: quoted-printable Message-Id: <80C77209-D114-40D8-8711-E314C254A677@tarantool.org> References: <20221028092638.11506-1-max.kokryashkin@gmail.com> <20221028092638.11506-5-max.kokryashkin@gmail.com> To: Maksim Kokryashkin X-Mailer: Apple Mail (2.3731.200.110.1.12) X-Mailru-Src: smtp X-4EC0790: 10 X-7564579A: 78E4E2B564C1792B X-77F55803: 4F1203BC0FB41BD908190A22B884CF14F3FEB22A099FE4AD22BC9066742E00AB182A05F538085040DE0E134E4404113B6A022A220CF013B7557C69FE615405F61535E07DD918192A X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE736C75B72B9FDC350B287FD4696A6DC2FA8DF7F3B2552694A4E2F5AFA99E116B42401471946AA11AF855697CD6E926167F74E19BB637114CF8F08D7030A58E5AD1A62830130A00468AEEEE3FBA3A834EE7353EFBB55337566E0197D30AADAD308DEA210955351F448EB556828C6606A7BA471835C12D1D9774AD6D5ED66289B5278DA827A17800CE77A825AB47F0FC8649FA2833FD35BB23D2EF20D2F80756B5F868A13BD56FB6657A471835C12D1D977725E5C173C3A84C381B3E0F64AD3EF57117882F4460429728AD0CFFFB425014E868A13BD56FB6657D81D268191BDAD3DC09775C1D3CA48CFFF30E5DF5FCA5605BA3038C0950A5D36C8A9BA7A39EFB766EC990983EF5C0329BA3038C0950A5D36D5E8D9A59859A8B660F0362104F3389376E601842F6C81A1F004C906525384303E02D724532EE2C3F43C7A68FF6260569E8FC8737B5C2249EC8D19AE6D49635B68655334FD4449CB9ECD01F8117BC8BEAAAE862A0553A39223F8577A6DFFEA7CD5703B978803C49E43847C11F186F3C59DAA53EE0834AAEE X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D344A2E3AE0A8792E69B431EC02C3B28D365585A72A88C8DA39563EBAA5B1FD7CA2057713DF6C25016F1D7E09C32AA3244CFFDB81F5D1FF9FB7CAFD7BE54F089BEA33C9DC155518937F927AC6DF5659F194 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojniwsktXAgUMz7QXUfVY2Jg== X-Mailru-Sender: 5AA3D5B9D8C486464BD4402E82A444E3E2126ED99C26DF254F0D87FE2F74DDD1744DAD48789798D719381EE24192DF5555834048F03EF5D4C9A814A92B2E3B1BA4250FC3964EA4964198E0F3ECE9B5443453F38A29522196 X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH luajit v4 4/8] ARM64: Reorder interpreter stack frame and fix unwinding. X-BeenThere: tarantool-patches@dev.tarantool.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: sergos via Tarantool-patches Reply-To: sergos Cc: tarantool-patches@dev.tarantool.org Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" Hi! Thanks for the patch! LGTM with fixes after SergeyK review. Sergos > On 28 Oct 2022, at 12:26, Maksim Kokryashkin = wrote: >=20 > From: Mike Pall >=20 > Reported by Yichun Zhang. Fixes #722. > May help towards fixing #698, too. >=20 > (cherry picked from commit 421c4c798791d27b7f967df39891c4e4fa1d107c) >=20 > The `_Unwind_Find_FDE` fails to find the FDE (frame descriptor > element) for `lj_vm_ffi_call` in DWARF unwind info, despite > the presence of its data in the `.debug_frame` section. >=20 > LuaJIT emits its own DWARF entries for the CFI (call frame > information, section 6.4.1 in DWARF standard)[1].The FP > register value is vital to perform unwinding, and it is > possible to restore that register using the Canonical > Frame Address, or CFA. It can be obtained as `CFA - offset`. > By default, the CFA register is SP, however, it can be > changed to any other. >=20 > According to ARM's calling convention, the first eight > arguments of a function must be passed in x0-x7 registers, > and all the remaining must be passed on the stack. The > latter fact is important because it affects the SP and, > because of that, the CFA invalidates. This patch changes > the CFA register to the FP for the lj_vm_ffi_call, which > fixes the issue. >=20 > All the other changes are made just for refactoring purposes. >=20 > [1]: https://dwarfstd.org/doc/DWARF5.pdf >=20 > Maxim Kokryashkin: > * added the description and the test case for the problem >=20 > Needed for tarantool/tarantool#6096 > Part of tarantool/tarantool#7230 > --- > src/lj_frame.h | 12 +- > src/vm_arm64.dasc | 189 ++++++++++++++---- > .../lj-698-arm-pcall-panic.test.lua | 18 ++ > 3 files changed, 170 insertions(+), 49 deletions(-) > create mode 100644 = test/tarantool-tests/lj-698-arm-pcall-panic.test.lua >=20 > diff --git a/src/lj_frame.h b/src/lj_frame.h > index 9fd63fa2..1e4adaa3 100644 > --- a/src/lj_frame.h > +++ b/src/lj_frame.h > @@ -192,12 +192,12 @@ enum { LJ_CONT_TAILCALL, LJ_CONT_FFI_CALLBACK }; = /* Special continuations. */ > #endif > #define CFRAME_SHIFT_MULTRES 3 > #elif LJ_TARGET_ARM64 > -#define CFRAME_OFS_ERRF 196 > -#define CFRAME_OFS_NRES 200 > -#define CFRAME_OFS_PREV 160 > -#define CFRAME_OFS_L 176 > -#define CFRAME_OFS_PC 168 > -#define CFRAME_OFS_MULTRES 192 > +#define CFRAME_OFS_ERRF 36 > +#define CFRAME_OFS_NRES 40 > +#define CFRAME_OFS_PREV 0 > +#define CFRAME_OFS_L 16 > +#define CFRAME_OFS_PC 8 > +#define CFRAME_OFS_MULTRES 32 > #define CFRAME_SIZE 208 > #define CFRAME_SHIFT_MULTRES 3 > #elif LJ_TARGET_PPC > diff --git a/src/vm_arm64.dasc b/src/vm_arm64.dasc > index 313cc94f..ad57bca3 100644 > --- a/src/vm_arm64.dasc > +++ b/src/vm_arm64.dasc > @@ -81,47 +81,49 @@ > | > |.define CFRAME_SPACE, 208 > |//----- 16 byte aligned, <-- sp entering interpreter > -|// Unused [sp, #204] // 32 bit values > -|.define SAVE_NRES, [sp, #200] > -|.define SAVE_ERRF, [sp, #196] > -|.define SAVE_MULTRES, [sp, #192] > -|.define TMPD, [sp, #184] // 64 bit values > -|.define SAVE_L, [sp, #176] > -|.define SAVE_PC, [sp, #168] > -|.define SAVE_CFRAME, [sp, #160] > -|.define SAVE_FPR_, 96 // 96+8*8: 64 bit FPR saves > -|.define SAVE_GPR_, 16 // 16+10*8: 64 bit GPR saves > -|.define SAVE_LR, [sp, #8] > -|.define SAVE_FP, [sp] > +|.define SAVE_LR, [sp, #200] > +|.define SAVE_FP, [sp, #192] > +|.define SAVE_GPR_, 112 // 112+10*8: 64 bit GPR saves > +|.define SAVE_FPR_, 48 // 48+8*8: 64 bit FPR saves > +|// Unused [sp, #44] // 32 bit values > +|.define SAVE_NRES, [sp, #40] > +|.define SAVE_ERRF, [sp, #36] > +|.define SAVE_MULTRES, [sp, #32] > +|.define TMPD, [sp, #24] // 64 bit values > +|.define SAVE_L, [sp, #16] > +|.define SAVE_PC, [sp, #8] > +|.define SAVE_CFRAME, [sp, #0] > |//----- 16 byte aligned, <-- sp while in interpreter. > | > -|.define TMPDofs, #184 > +|.define TMPDofs, #24 > | > |.macro save_, gpr1, gpr2, fpr1, fpr2 > -| stp d..fpr1, d..fpr2, [sp, # SAVE_FPR_+(fpr1-8)*8] > -| stp x..gpr1, x..gpr2, [sp, # SAVE_GPR_+(gpr1-19)*8] > +| stp d..fpr2, d..fpr1, [sp, # SAVE_FPR_+(14-fpr1)*8] > +| stp x..gpr2, x..gpr1, [sp, # SAVE_GPR_+(27-gpr1)*8] > |.endmacro > |.macro rest_, gpr1, gpr2, fpr1, fpr2 > -| ldp d..fpr1, d..fpr2, [sp, # SAVE_FPR_+(fpr1-8)*8] > -| ldp x..gpr1, x..gpr2, [sp, # SAVE_GPR_+(gpr1-19)*8] > +| ldp d..fpr2, d..fpr1, [sp, # SAVE_FPR_+(14-fpr1)*8] > +| ldp x..gpr2, x..gpr1, [sp, # SAVE_GPR_+(27-gpr1)*8] > |.endmacro > | > |.macro saveregs > -| stp fp, lr, [sp, #-CFRAME_SPACE]! > +| sub sp, sp, # CFRAME_SPACE > +| stp fp, lr, SAVE_FP > | add fp, sp, #0 > -| stp x19, x20, [sp, # SAVE_GPR_] > +| stp x20, x19, [sp, # SAVE_GPR_+(27-19)*8] > | save_ 21, 22, 8, 9 > | save_ 23, 24, 10, 11 > | save_ 25, 26, 12, 13 > | save_ 27, 28, 14, 15 > |.endmacro > |.macro restoreregs > -| ldp x19, x20, [sp, # SAVE_GPR_] > +| ldp x20, x19, [sp, # SAVE_GPR_+(27-19)*8] > | rest_ 21, 22, 8, 9 > | rest_ 23, 24, 10, 11 > | rest_ 25, 26, 12, 13 > | rest_ 27, 28, 14, 15 > -| ldp fp, lr, [sp], # CFRAME_SPACE > +| ldp fp, lr, SAVE_FP > +| add sp, sp, # CFRAME_SPACE > |.endmacro > | > |// Type definitions. Some of these are only used for documentation. > @@ -2125,9 +2127,9 @@ static void build_subroutines(BuildCtx *ctx) > | // Caveat: needs special frame unwinding, see below. > |.if FFI > | .type CCSTATE, CCallState, x19 > - | stp fp, lr, [sp, #-32]! > + | stp x20, CCSTATE, [sp, #-32]! > + | stp fp, lr, [sp, #16] > | add fp, sp, #0 > - | str CCSTATE, [sp, #16] > | mov CCSTATE, x0 > | ldr TMP0w, CCSTATE:x0->spadj > | ldrb TMP1w, CCSTATE->nsp > @@ -2156,8 +2158,8 @@ static void build_subroutines(BuildCtx *ctx) > | stp x0, x1, CCSTATE->gpr[0] > | stp d0, d1, CCSTATE->fpr[0] > | stp d2, d3, CCSTATE->fpr[2] > - | ldr CCSTATE, [sp, #16] > - | ldp fp, lr, [sp], #32 > + | ldp fp, lr, [sp, #16] > + | ldp x20, CCSTATE, [sp], #32 > | ret > |.endif > |// Note: vm_ffi_call must be the last function in this object file! > @@ -2887,7 +2889,7 @@ static void build_ins(BuildCtx *ctx, BCOp op, = int defop) > case BC_GGET: > | // RA =3D dst, RC =3D str_const (~) > case BC_GSET: > - | // RA =3D dst, RC =3D str_const (~) > + | // RA =3D src, RC =3D str_const (~) > | ldr LFUNC:CARG1, [BASE, FRAME_FUNC] > | mvn RC, RC > | and LFUNC:CARG1, CARG1, #LJ_GCVMASK > @@ -3863,7 +3865,7 @@ static int build_backend(BuildCtx *ctx) > static void emit_asm_debug(BuildCtx *ctx) > { > int fcofs =3D (int)((uint8_t *)ctx->glob[GLOB_vm_ffi_call] - = ctx->code); > - int i, cf =3D CFRAME_SIZE >> 3; > + int i; > switch (ctx->mode) { > case BUILD_elfasm: > fprintf(ctx->fp, "\t.section .debug_frame,\"\",%%progbits\n"); > @@ -3888,14 +3890,14 @@ static void emit_asm_debug(BuildCtx *ctx) > "\t.quad .Lbegin\n" > "\t.quad %d\n" > "\t.byte 0xe\n\t.uleb128 %d\n" /* def_cfa_offset */ > - "\t.byte 0x9d\n\t.uleb128 %d\n" /* offset fp */ > - "\t.byte 0x9e\n\t.uleb128 %d\n", /* offset lr */ > - fcofs, CFRAME_SIZE, cf, cf-1); > + "\t.byte 0x9e\n\t.uleb128 1\n" /* offset lr */ > + "\t.byte 0x9d\n\t.uleb128 2\n", /* offset fp */ > + fcofs, CFRAME_SIZE); > for (i =3D 19; i <=3D 28; i++) /* offset x19-x28 */ > - fprintf(ctx->fp, "\t.byte 0x%x\n\t.uleb128 %d\n", 0x80+i, = cf-i+17); > + fprintf(ctx->fp, "\t.byte 0x%x\n\t.uleb128 %d\n", 0x80+i, = i+(3-19)); > for (i =3D 8; i <=3D 15; i++) /* offset d8-d15 */ > fprintf(ctx->fp, "\t.byte 5\n\t.uleb128 0x%x\n\t.uleb128 %d\n", > - 64+i, cf-i-4); > + 64+i, i+(3+(28-19+1)-8)); > fprintf(ctx->fp, > "\t.align 3\n" > ".LEFDE0:\n\n"); > @@ -3908,9 +3910,11 @@ static void emit_asm_debug(BuildCtx *ctx) > "\t.quad lj_vm_ffi_call\n" > "\t.quad %d\n" > "\t.byte 0xe\n\t.uleb128 32\n" /* def_cfa_offset */ > - "\t.byte 0x9d\n\t.uleb128 4\n" /* offset fp */ > - "\t.byte 0x9e\n\t.uleb128 3\n" /* offset lr */ > - "\t.byte 0x93\n\t.uleb128 2\n" /* offset x19 */ > + "\t.byte 0x9e\n\t.uleb128 1\n" /* offset lr */ > + "\t.byte 0x9d\n\t.uleb128 2\n" /* offset fp */ > + "\t.byte 0x93\n\t.uleb128 3\n" /* offset x19 */ > + "\t.byte 0x94\n\t.uleb128 4\n" /* offset x20 */ > + "\t.byte 0xd\n\t.uleb128 0x1d\n" /* def_cfa_register fp = */ > "\t.align 3\n" > ".LEFDE1:\n\n", (int)ctx->codesz - fcofs); > #endif > @@ -3941,14 +3945,14 @@ static void emit_asm_debug(BuildCtx *ctx) > "\t.long %d\n" > "\t.uleb128 0\n" /* augmentation length = */ > "\t.byte 0xe\n\t.uleb128 %d\n" /* def_cfa_offset */ > - "\t.byte 0x9d\n\t.uleb128 %d\n" /* offset fp */ > - "\t.byte 0x9e\n\t.uleb128 %d\n", /* offset lr */ > - fcofs, CFRAME_SIZE, cf, cf-1); > + "\t.byte 0x9e\n\t.uleb128 1\n" /* offset lr */ > + "\t.byte 0x9d\n\t.uleb128 2\n", /* offset fp */ > + fcofs, CFRAME_SIZE); > for (i =3D 19; i <=3D 28; i++) /* offset x19-x28 */ > - fprintf(ctx->fp, "\t.byte 0x%x\n\t.uleb128 %d\n", 0x80+i, = cf-i+17); > + fprintf(ctx->fp, "\t.byte 0x%x\n\t.uleb128 %d\n", 0x80+i, = i+(3-19)); > for (i =3D 8; i <=3D 15; i++) /* offset d8-d15 */ > fprintf(ctx->fp, "\t.byte 5\n\t.uleb128 0x%x\n\t.uleb128 %d\n", > - 64+i, cf-i-4); > + 64+i, i+(3+(28-19+1)-8)); > fprintf(ctx->fp, > "\t.align 3\n" > ".LEFDE2:\n\n"); > @@ -3977,13 +3981,112 @@ static void emit_asm_debug(BuildCtx *ctx) > "\t.long %d\n" > "\t.uleb128 0\n" /* augmentation length = */ > "\t.byte 0xe\n\t.uleb128 32\n" /* def_cfa_offset */ > - "\t.byte 0x9d\n\t.uleb128 4\n" /* offset fp */ > - "\t.byte 0x9e\n\t.uleb128 3\n" /* offset lr */ > - "\t.byte 0x93\n\t.uleb128 2\n" /* offset x19 */ > + "\t.byte 0x9e\n\t.uleb128 1\n" /* offset lr */ > + "\t.byte 0x9d\n\t.uleb128 2\n" /* offset fp */ > + "\t.byte 0x93\n\t.uleb128 3\n" /* offset x19 */ > + "\t.byte 0x94\n\t.uleb128 4\n" /* offset x20 */ > + "\t.byte 0xd\n\t.uleb128 0x1d\n" /* def_cfa_register fp = */ > "\t.align 3\n" > ".LEFDE3:\n\n", (int)ctx->codesz - fcofs); > #endif > break; > +#if !LJ_NO_UNWIND > + case BUILD_machasm: { > +#if LJ_HASFFI > + int fcsize =3D 0; > +#endif > + int j; > + fprintf(ctx->fp, "\t.section = __TEXT,__eh_frame,coalesced,no_toc+strip_static_syms+live_support\n"); > + fprintf(ctx->fp, > + "EH_frame1:\n" > + "\t.set L$set$x,LECIEX-LSCIEX\n" > + "\t.long L$set$x\n" > + "LSCIEX:\n" > + "\t.long 0\n" > + "\t.byte 0x1\n" > + "\t.ascii \"zPR\\0\"\n" > + "\t.byte 0x1\n" > + "\t.byte 128-8\n" > + "\t.byte 30\n" /* Return address is in = lr. */ > + "\t.byte 6\n" /* augmentation length = */ > + "\t.byte 0x9b\n" /* indirect|pcrel|sdata4 = */ > + "\t.long _lj_err_unwind_dwarf@GOTPCREL\n" > + "\t.byte 0x1b\n" /* pcrel|sdata4 */ > + "\t.byte 0xc\n\t.byte 31\n\t.byte 0\n" /* def_cfa sp */ > + "\t.align 3\n" > + "LECIEX:\n\n"); > + for (j =3D 0; j < ctx->nsym; j++) { > + const char *name =3D ctx->sym[j].name; > + int32_t size =3D ctx->sym[j+1].ofs - ctx->sym[j].ofs; > + if (size =3D=3D 0) continue; > +#if LJ_HASFFI > + if (!strcmp(name, "_lj_vm_ffi_call")) { fcsize =3D size; = continue; } > +#endif > + fprintf(ctx->fp, > + "%s.eh:\n" > + "LSFDE%d:\n" > + "\t.set L$set$%d,LEFDE%d-LASFDE%d\n" > + "\t.long L$set$%d\n" > + "LASFDE%d:\n" > + "\t.long LASFDE%d-EH_frame1\n" > + "\t.long %s-.\n" > + "\t.long %d\n" > + "\t.byte 0\n" /* augmentation length = */ > + "\t.byte 0xe\n\t.byte %d\n\t.byte 1\n" /* def_cfa_offset */ > + "\t.byte 0x9e\n\t.byte 1\n" /* offset lr */ > + "\t.byte 0x9d\n\t.byte 2\n", /* offset fp */ > + name, j, j, j, j, j, j, j, name, size, CFRAME_SIZE); > + for (i =3D 19; i <=3D 28; i++) /* offset x19-x28 */ > + fprintf(ctx->fp, "\t.byte 0x%x\n\t.byte %d\n", 0x80+i, = i+(3-19)); > + for (i =3D 8; i <=3D 15; i++) /* offset d8-d15 */ > + fprintf(ctx->fp, "\t.byte 5\n\t.byte 0x%x\n\t.byte %d\n", > + 64+i, i+(3+(28-19+1)-8)); > + fprintf(ctx->fp, > + "\t.align 3\n" > + "LEFDE%d:\n\n", j); > + } > +#if LJ_HASFFI > + if (fcsize) { > + fprintf(ctx->fp, > + "EH_frame2:\n" > + "\t.set L$set$y,LECIEY-LSCIEY\n" > + "\t.long L$set$y\n" > + "LSCIEY:\n" > + "\t.long 0\n" > + "\t.byte 0x1\n" > + "\t.ascii \"zR\\0\"\n" > + "\t.byte 0x1\n" > + "\t.byte 128-8\n" > + "\t.byte 30\n" /* Return address is in = lr. */ > + "\t.byte 1\n" /* augmentation length = */ > + "\t.byte 0x1b\n" /* pcrel|sdata4 */ > + "\t.byte 0xc\n\t.byte 31\n\t.byte 0\n" /* def_cfa sp */ > + "\t.align 3\n" > + "LECIEY:\n\n"); > + fprintf(ctx->fp, > + "_lj_vm_ffi_call.eh:\n" > + "LSFDEY:\n" > + "\t.set L$set$yy,LEFDEY-LASFDEY\n" > + "\t.long L$set$yy\n" > + "LASFDEY:\n" > + "\t.long LASFDEY-EH_frame2\n" > + "\t.long _lj_vm_ffi_call-.\n" > + "\t.long %d\n" > + "\t.byte 0\n" /* augmentation length = */ > + "\t.byte 0xe\n\t.byte 32\n" /* def_cfa_offset */ > + "\t.byte 0x9e\n\t.byte 1\n" /* offset lr */ > + "\t.byte 0x9d\n\t.byte 2\n" /* offset fp */ > + "\t.byte 0x93\n\t.byte 3\n" /* offset x19 */ > + "\t.byte 0x94\n\t.byte 4\n" /* offset x20 */ > + "\t.byte 0xd\n\t.uleb128 0x1d\n" /* def_cfa_register fp = */ > + "\t.align 3\n" > + "LEFDEY:\n\n", fcsize); > + } > +#endif > + fprintf(ctx->fp, ".subsections_via_symbols\n"); > + } > + break; > +#endif > default: > break; > } > diff --git a/test/tarantool-tests/lj-698-arm-pcall-panic.test.lua = b/test/tarantool-tests/lj-698-arm-pcall-panic.test.lua > new file mode 100644 > index 00000000..88476d3e > --- /dev/null > +++ b/test/tarantool-tests/lj-698-arm-pcall-panic.test.lua > @@ -0,0 +1,18 @@ > +local tap =3D require('tap') > + > +-- See also https://github.com/LuaJIT/LuaJIT/issues/698. > +local test =3D tap.test('lj-418-arm-pcall-panic') > +test:plan(1) > + > +local ffi =3D require('ffi') > +-- The test case below was taken from the LuaJIT-tests > +-- suite (lib/ffi/ffi_callback.lua), and should be removed > +-- after the integration of the mentioned suite. > +local runner =3D ffi.cast("int (*)(int, int, int, int, int, int, int, = int, int)", > + function() error("test") end > + ) > + > +local st =3D pcall(runner, 1, 1, 1, 1, 1, 1, 1, 1, 1) > +test:ok(not st, 'error handling completed correctly') > + > +os.exit(test:check() and 0 or 1) > --=20 > 2.37.0 (Apple Git-136) >=20