[Tarantool-patches] [PATCH luajit v4 8/8] OSX/ARM64: Fix external unwinding.

Sergey Kaplun skaplun at tarantool.org
Thu Dec 1 11:52:18 MSK 2022


Hi, thanks for the explanations!
LGTM, then.

On 30.11.22, Maxim Kokryashkin wrote:
> 
> Hi!
> Thanks for the review!
>  
>> >>Hi, Maksim!
> >>
> >>Thanks for the patch!
> >>
> >>LGTM, but I have a bunch of questions to clarify it.
> >>
> >>On 28.10.22, Maksim Kokryashkin wrote:
> >>> Contributed by Edmund Kapusniak. For more info,
> >>> see #698 and #757.
> >>>
> >>> (cherry picked from commit c38747b626b978555324504ec29a110f6b04902f)
> >>>
> >>> To allow compiler generate compact unwind info generation
> >>> for Mach-O, fp must point to the saved fp, and the frame
> >>> must be specified relative to fp+16.
> >>
> >>Is there any link to documentation or source code to inspect this
> >>behaviour?
> >Unfortunately, there are no official docs for that. However, there is
> >a community effort to create one here[1]. Also, this header file from
> >the Apple’s sources is quite useful. Added both of them to commit
> >message for those who will get the masculine urge to dive into this.

Meh, not much info about it in the mentioned doc.

I suppose that aarch64 ABI requires to save fp and lr by analog with arm
arch. See the following comment for arm (unfortunately, there is no such
comment for aarch64).
https://github.com/gcc-mirror/gcc/blob/master/gcc/config/arm/arm.h#L812

But I'm still struggling to find some relative docs about it.

> >>
> >>> ELF unwind info has
> >>> been updated to also use fp+16 rather than sp+CFRAME_SIZE.
> >>

<snipped>

> >>> Offset to pointer to personality routine specified as @GOT-. rather
> >>> than @GOTPCREL.
> >>
> >>Does it mean that we use incorrect encoded offset (I see encoding for
> >>offset is still the same) for our personality routine?
> >>If so, maybe the other changes are just refactoring?
> >No, that is not correct. Offset has changed, because any 
> >`func at GOT` expression is translated into offset.
> >Moreover, I doubt it is possible to fill in offset to GOT by hand.
> >What goes after the pointer to the personality routine
> >is LSDA, according to the Apple’s source[2]. @GOTPCREL and @GOT
> >are interchangeable most of the time, except for the cases when signed
> >32-bit RIP references are not enough for you, which seems to be the case here.

So, GOTPCREL allows you to "recalculate" reference to a function to
32-bit value and use it? Do I get the idea correct?

> >>
> >>>
> >>> Re-enabled LUAJIT_UNWIND_EXTERNAL by default on OSX.
> >>>
> >>> Maxim Kokryashkin:
> >>> * added the description for the issue and the test
> >>>
> >>> Resolves tarantool/tarantool#6096
> >>> Part of tarantool/tarantool#7230
> >>> ---

<snipped>

> >[1]:  https://faultlore.com/blah/compact-unwinding/#unwinding-tables-dwarf-cfi
> >[2]:  https://opensource.apple.com/source/libunwind/libunwind-35.3/include/mach-o/compact_unwind_encoding.h
> >--
> >Best regards,
> >Maxim Kokryashkin
>
-- 
Best regards,
Sergey Kaplun


More information about the Tarantool-patches mailing list