[llvm-dev] Supporting libunwind on Windows 10 (32bit; 64bit) for MSVC and Clang

Ivan Serdyuk via llvm-dev llvm-dev at lists.llvm.org
Sun Aug 16 16:17:18 PDT 2020


Martin,
good to hear from you.
Thanks for the effort - I will test on 32bit and 64bit Windows 10.
I will report ASAP.

Ivan

On Sun, Aug 16, 2020 at 8:42 PM Martin Storsjö <martin at martin.st> wrote:

> On Sat, 15 Aug 2020, Ivan Serdyuk wrote:
>
> >
> >
> > On Sat, Aug 15, 2020 at 8:39 PM Martin Storsjö <martin at martin.st> wrote:
> >       Hi,
> >
> >
> >       On Sat, 15 Aug 2020, Ivan Serdyuk wrote:
> >
> >       >       Just as Shoaib said, libunwind only is useful in
> >       environments
> >       >       that use
> >       >       the Itanium C++ ABI - there's really no use for it in an
> >       MSVC
> >       >       context
> >       >       (either using MSVC or clang-cl to compile it).
> >       >
> >       >       The particular linker error comes from the fact that
> >       there's
> >       >       functions
> >       >       implemented in assembly, that expect the function name
> >       to be
> >       >       mangled the
> >       >       itanium way, while the object files built by the
> >       compiler expect
> >       >       the
> >       >       symbols to use the MSVC C++ name mangling, so there's an
> >       >       undefined
> >       >       reference.
> >       >
> >       >
> >       > I see, thanks.
> >       >
> >       > Which options exist for MSVC, in sense an alternative to
> >       libunwind and
> >       > libbacktrace ?
> >
> >       Well for libunwind, there's really no use for it in an MSVC
> >       setting. All
> >       the unwinding functionality is already built into the operating
> >       system,
> >       available via the Rtl*Unwind* functions.
> >
> >
> > Martin,
> > you mean these functions
> >
> https://docs.microsoft.com/en-us/windows/win32/api/winnt/nf-winnt-rtlunwind
> >
> >
> https://docs.microsoft.com/en-us/windows/win32/api/winnt/nf-winnt-rtlunwind
> > 2
> >
> https://docs.microsoft.com/en-us/windows/win32/api/winnt/nf-winnt-rtlunwind
> > ex
> >
> https://docs.microsoft.com/en-us/windows/win32/api/winnt/nf-winnt-rtlvirtua
> > lunwind
> > ?
>
> Yes, those are the functions used for unwinding on windows.
>
> >       For libbacktrace, I guess the _Unwind_Backtrace function in
> >       libunwind
> >       might work and be useful, even if the rest of libunwind doesn't
> >       make sense
> >       in such a context.
>
> Just FWIW, I made a RFC patch that fixes building libunwind in MSVC mode
> (still requiring clang-cl though), at https://reviews.llvm.org/D86041 -
> mostly just to show what it takes - not convinced that it necessarily is
> something that should be done.
>
> It does seem like _Unwind_Backtrace in libunwind doesn't work properly on
> x86_64 windows at the moment though, but on aarch64 it seems to do what
> one would expect.
>
> // Martin
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20200816/9d31490c/attachment.html>


More information about the llvm-dev mailing list