[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:02:34 PDT 2020


Hi,

On Sat, 15 Aug 2020, Ivan Serdyuk via llvm-dev wrote:

> I was trying to
> compile https://github.com/llvm/llvm-project/tree/master/libunwind using:
>  *  MSVC
>  *  Clang
> I wasn't able to configure this project for using MSVC (directly or via
> clang-cl):

> error LNK2019: unresolved external symbol "public: void __thiscall
> libunwind::Registers_x86::jumpto(void)"
> (?jumpto at Registers_x86@libunwind@@QAEXXZ) referenced in function "public:
> virtual void __thiscall libunwind::UnwindCursor<class
> libunwind::LocalAddressSpace,class libunwind::Registers_x86>::jumpto(void)"(?jumpto@?$UnwindCursor at VLocalAddressSpace@libunwind@@VRegisters_x86 at 2@@lib
> unwind@@UAEXXZ)
> lib\unwind.dll : fatal error LNK1120: 1 unresolved externals
> clang: error: linker command failed with exit code 1120 (use -v to see
> invocation)
> ninja: build stopped: subcommand failed.

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.

// Martin


More information about the llvm-dev mailing list