[LLVMdev] linking a parser bitcode

Anton Korobeynikov anton at korobeynikov.info
Fri Dec 4 14:19:31 PST 2009

Hello, Samuel

> While we have been discussing this, my partner discovered the source of where the sj/lj stuff is coming from.  Does this mean that the LLVM libraries we're using are broken?
> Type.cpp
> ..\..\..\..\llvm\lib/libLLVMCore.a(Type.cpp.obj):Type.cpp.text+0x722): undefined reference to `__gxx_personality_sj0'
> ..\..\..\..\llvm\lib/libLLVMCore.a(Type.cpp.obj):Type.cpp.text+0x750): undefined reference to `_Unwind_SjLj_Register'
> ..\..\..\..\llvm\lib/libLLVMCore.a(Type.cpp.obj):Type.cpp.text+0x848): undefined reference to `_Unwind_SjLj_Resume'
> ..\..\..\..\llvm\lib/libLLVMCore.a(Type.cpp.obj):Type.cpp.text+0xa31): undefined reference to `_Unwind_SjLj_Resume'
Ah, I've re-read the whole thread and now understand the whole situation:

1. You compiled llvm (on windows, as it seems to me) with the compiler
which does sjlj-style EH (e.g. mingw's gcc 3.4.5)
2. LLVM supports only dwarf-based EH (however, EH on windows is
currently unsupported), thus llvm-compiled libgcc does not contain any
sjlj-related routines

So, the best way to resolve the situation is:
 - Do not use EH in the code you're compiling via llvm-gcc (it won't
work until someone will feel brave to implement missed EH bits on
 - link everything with g++, not llvm-g++

Hope this will help.

With best regards, Anton Korobeynikov
Faculty of Mathematics and Mechanics, Saint Petersburg State University

More information about the llvm-dev mailing list