From: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH 2/2] package/mono: add libunwind optional dependency
Date: Sat, 18 May 2019 22:40:52 +0200 [thread overview]
Message-ID: <20190518224052.42fdd3c5@windsurf> (raw)
In-Reply-To: <CAPi7W82iu7AYsC0NzXHTiMFvR-4Q6+rfpzPHy_ZLHMn=hZZf0g@mail.gmail.com>
Hello,
+Arnout in case he has some background knowledge on libunwind.
On Thu, 16 May 2019 21:43:20 +0200
Fabrice Fontaine <fontaine.fabrice@gmail.com> wrote:
> > Did you make some further research to understand what is
> > _Unwind_GetIP ? Or was your analysis just based on "mono needs
> > _Unwind_GetIP, it's provided by libunwind, let's link with it" ?
> My analysis was based on the fact that the build failures occured only
> when libunwind was built before mono.
> I traced back this error to the installation of unwind.h by libunwind
> which contains the following definition of _Unwind_GetIP:
> extern unsigned long _Unwind_GetIP (struct _Unwind_Context *);
>
> However, libunwind implements _Unwind_GetIP in src/unwind/GetIP.c only
> if --enable-cxx-exceptions is defined.
>
> On his side, mono includes unwind.h if it's available:
> #ifdef HAVE_UNWIND_H
> #include <unwind.h>
> #endif
>
> unwind.h and _Unwind_GetIP can also be provided by glibc but that's
> not the cause of this build failure on musl.
Hm, did you notice that mono has its own libunwind library, which
provides _Unwind_GetIP ?
See:
external/corert/src/Native/libunwind/src/UnwindLevel1-gcc-ext.c:_LIBUNWIND_EXPORT uintptr_t _Unwind_GetIPInfo(struct _Unwind_Context *context,
external/corert/src/Native/libunwind/src/UnwindLevel1-gcc-ext.c: _LIBUNWIND_TRACE_API("_Unwind_GetIPInfo(context=%p)", (void *)context);
external/corert/src/Native/libunwind/src/UnwindLevel1-gcc-ext.c: return _Unwind_GetIP(context);
external/corert/src/Native/libunwind/src/Unwind-EHABI.cpp: uintptr_t pc = _Unwind_GetIP(context);
external/corert/src/Native/libunwind/src/Unwind-sjlj.c:_LIBUNWIND_EXPORT uintptr_t _Unwind_GetIP(struct _Unwind_Context *context) {
external/corert/src/Native/libunwind/src/Unwind-sjlj.c: _LIBUNWIND_TRACE_API("_Unwind_GetIP(context=%p) => 0x%lX", context,
external/corert/src/Native/libunwind/src/Unwind-sjlj.c:_LIBUNWIND_EXPORT uintptr_t _Unwind_GetIPInfo(struct _Unwind_Context *context,
external/corert/src/Native/libunwind/src/Unwind-sjlj.c: _LIBUNWIND_TRACE_API("_Unwind_GetIPInfo(context=%p, %p) => 0x%lX",
external/corert/src/Native/libunwind/src/UnwindCursor.hpp: // This matches the behaviour of _Unwind_GetIP on arm.
external/corert/src/Native/libunwind/src/UnwindLevel1.c:_LIBUNWIND_EXPORT uintptr_t _Unwind_GetIP(struct _Unwind_Context *context) {
external/corert/src/Native/libunwind/src/UnwindLevel1.c: _LIBUNWIND_TRACE_API("_Unwind_GetIP(context=%p) => 0x%" PRIx64,
external/corert/src/Native/libunwind/src/Unwind_AppleExtras.cpp:NOT_HERE_BEFORE_10_6(_Unwind_GetIP)
external/corert/src/Native/libunwind/src/Unwind_AppleExtras.cpp:NOT_HERE_BEFORE_10_6(_Unwind_GetIPInfo)
external/corert/src/Native/libunwind/src/Unwind_AppleExtras.cpp:NOT_HERE_BEFORE_5_0(_Unwind_GetIP)
external/corert/src/Native/libunwind/src/Unwind_AppleExtras.cpp:NOT_HERE_BEFORE_5_0(_Unwind_GetIPInfo)
external/corert/src/Native/libunwind/include/unwind.h:extern uintptr_t _Unwind_GetIP(struct _Unwind_Context *context);
external/corert/src/Native/libunwind/include/unwind.h:uintptr_t _Unwind_GetIP(struct _Unwind_Context *context) {
external/corert/src/Native/libunwind/include/unwind.h:// _Unwind_GetIPInfo is a gcc extension that can be called from within a
external/corert/src/Native/libunwind/include/unwind.h:// personality handler. Similar to _Unwind_GetIP() but also returns in
external/corert/src/Native/libunwind/include/unwind.h:extern uintptr_t _Unwind_GetIPInfo(struct _Unwind_Context *context,
Also
http://refspecs.linuxfoundation.org/LSB_4.1.0/LSB-Core-generic/LSB-Core-generic.html#LIBGCC-SMAN
says _Unwind_GetIP() is supposed to be provided by libgcc_s.
On the other hand, glibc and uclibc provide a _Unwind_GetIP macro, but
only for ARM. uClibc libubacktrace also contains this:
static void backtrace_init (void)
{
void *handle = dlopen (LIBGCC_S_SO, RTLD_LAZY);
if (handle == NULL
|| ((unwind_backtrace = dlsym (handle, "_Unwind_Backtrace")) == NULL)
|| ((unwind_getip = dlsym (handle, "_Unwind_GetIP")) == NULL)) {
printf(LIBGCC_S_SO " must be installed for backtrace to work\n");
abort();
}
}
So it looks for _Unwind_GetIP in libgcc.
So, I'm really confused by what is supposed to provide _Unwind_GetIP(),
and I don't feel comfortable with just saying "libunwind has it, let's
use it".
Thomas
--
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
next prev parent reply other threads:[~2019-05-18 20:40 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-15 20:47 [Buildroot] [PATCH 1/2] package/libunwind: add cxx exceptions support Fabrice Fontaine
2019-05-15 20:47 ` [Buildroot] [PATCH 2/2] package/mono: add libunwind optional dependency Fabrice Fontaine
2019-05-16 6:29 ` Thomas Petazzoni
2019-05-16 19:43 ` Fabrice Fontaine
2019-05-18 20:40 ` Thomas Petazzoni [this message]
2019-05-25 17:03 ` Arnout Vandecappelle
2019-08-16 7:22 ` Angelo Compagnucci
2019-08-16 8:34 ` Fabrice Fontaine
2019-10-27 18:26 ` Arnout Vandecappelle
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=20190518224052.42fdd3c5@windsurf \
--to=thomas.petazzoni@bootlin.com \
--cc=buildroot@busybox.net \
/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
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox