[llvm-dev] Supporting libunwind on Windows 10 (32bit; 64bit) for MSVC and Clang
Martin Storsjö via llvm-dev
llvm-dev at lists.llvm.org
Sat Aug 15 13:39:13 PDT 2020
Please keep the discussion on the list.
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
> (either using MSVC or clang-cl to compile it).
> The particular linker error comes from the fact that there's
> implemented in assembly, that expect the function name to be
> mangled the
> itanium way, while the object files built by the compiler expect
> symbols to use the MSVC C++ name mangling, so there's an
> 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.
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. I haven't tested this function on windows though, and
it'd require you to fix the linker error one way or another.
Another alternative, requiring much less code, would be to just extract
the SEH version of _Unwind_Backtrace function from libgcc . I think
that function is fairly independent from the rest of libgcc and from the
rest of the surrounding file, and only calls Windows system APIs.
More information about the llvm-dev