Tarantool development patches archive
 help / color / mirror / Atom feed
From: Sergey Kaplun via Tarantool-patches <tarantool-patches@dev.tarantool.org>
To: Maxim Kokryashkin <m.kokryashkin@tarantool.org>,
	Maksim Kokryashkin <max.kokryashkin@gmail.com>,
	tarantool-patches@dev.tarantool.org
Subject: Re: [Tarantool-patches] [PATCH luajit v4 8/8] OSX/ARM64: Fix external unwinding.
Date: Thu, 1 Dec 2022 15:28:01 +0300	[thread overview]
Message-ID: <Y4id0brLCYQ3eOg4@root> (raw)
In-Reply-To: <Y4hrQkelVoR+1t1G@root>

Hi, again!

On 01.12.22, Sergey Kaplun via Tarantool-patches wrote:
> 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@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?

Yes, this is the issue mentioned here:
https://github.com/LuaJIT/LuaJIT/issues/698#issuecomment-841645665

And usage of @GOT-. fixes the build for M1.

> 
> > >>
> > >>>
> > >>> 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

-- 
Best regards,
Sergey Kaplun

  reply	other threads:[~2022-12-01 12:31 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20221028092638.11506-1-max.kokryashkin@gmail.com>
     [not found] ` <20221028092638.11506-8-max.kokryashkin@gmail.com>
2022-11-24 11:56   ` [Tarantool-patches] [PATCH luajit v4 7/8] Fix build with busybox grep Sergey Kaplun via Tarantool-patches
2022-11-30 13:06     ` Maxim Kokryashkin via Tarantool-patches
2022-12-05 21:51   ` sergos via Tarantool-patches
     [not found] ` <20221028092638.11506-2-max.kokryashkin@gmail.com>
2022-12-05 16:01   ` [Tarantool-patches] [PATCH luajit v4 1/8] Cleanup and enable external unwinding for more platforms sergos via Tarantool-patches
     [not found] ` <20221028092638.11506-3-max.kokryashkin@gmail.com>
2022-12-05 16:06   ` [Tarantool-patches] [PATCH luajit v4 2/8] OSX: Fix build by hardcoding external frame unwinding sergos via Tarantool-patches
     [not found] ` <20221028092638.11506-4-max.kokryashkin@gmail.com>
2022-12-05 16:11   ` [Tarantool-patches] [PATCH luajit v4 3/8] OSX/ARM64: Disable external unwinding for now sergos via Tarantool-patches
     [not found] ` <20221028092638.11506-5-max.kokryashkin@gmail.com>
2022-11-24 11:37   ` [Tarantool-patches] [PATCH luajit v4 4/8] ARM64: Reorder interpreter stack frame and fix unwinding Sergey Kaplun via Tarantool-patches
2022-11-30 13:04     ` Maxim Kokryashkin via Tarantool-patches
2022-12-05 21:42   ` sergos via Tarantool-patches
     [not found] ` <20221028092638.11506-6-max.kokryashkin@gmail.com>
2022-11-24 11:41   ` [Tarantool-patches] [PATCH luajit v4 5/8] OSX/ARM64: Disable unwind info Sergey Kaplun via Tarantool-patches
2022-11-30 13:05     ` Maxim Kokryashkin via Tarantool-patches
2022-12-05 21:43   ` sergos via Tarantool-patches
     [not found] ` <20221028092638.11506-7-max.kokryashkin@gmail.com>
2022-11-24 11:49   ` [Tarantool-patches] [PATCH luajit v4 6/8] BSD: Fix build with BSD grep Sergey Kaplun via Tarantool-patches
2022-11-30 13:05     ` Maxim Kokryashkin via Tarantool-patches
2022-12-05 21:46   ` sergos via Tarantool-patches
     [not found] ` <20221028092638.11506-9-max.kokryashkin@gmail.com>
2022-11-24 13:10   ` [Tarantool-patches] [PATCH luajit v4 8/8] OSX/ARM64: Fix external unwinding Sergey Kaplun via Tarantool-patches
2022-11-30 13:21     ` Maxim Kokryashkin via Tarantool-patches
2022-12-01  8:52       ` Sergey Kaplun via Tarantool-patches
2022-12-01 12:28         ` Sergey Kaplun via Tarantool-patches [this message]
2022-12-06  5:58   ` sergos via Tarantool-patches

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Y4id0brLCYQ3eOg4@root \
    --to=tarantool-patches@dev.tarantool.org \
    --cc=m.kokryashkin@tarantool.org \
    --cc=max.kokryashkin@gmail.com \
    --cc=skaplun@tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH luajit v4 8/8] OSX/ARM64: Fix external unwinding.' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox