Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

LLVM and visual studio .obj binary incompatibility

Does anyone know if LLVM binary compatibility is planned for visual studio combiled .obj and static .lib files? Right now I can only link LLVM made .obj files with dynamic libs that loads a DLL at runtime (compiled from visual studio).

While there probably is very small chances that binary compatibility will happen between the two compilers, does anybody know why it is so difficult achieving this between compilers for one platform?

like image 200
Andos Avatar asked Jun 13 '11 11:06

Andos


1 Answers

As Neil already said, the compatibility includes stuff like calling convention, name mangling, etc. Though these two are the smallest possible problems. LLVM already knows about all windows-specific calling conventions (stdcall, fastcall, thiscall), this is why you can call stuff from .dll's.

If we speak about C++ code then the main problem is C++ ABI: vtable layout, rtti implementation, etc. clang follows Itanium C++ ABI (which gcc use, for example, among others), VCPP - doesn't and all these are undocumented, unfortunately. There is some work going in clang in this direction, so stuff might start to work apparently. Note that most probably some parts will never be covered, e.g. seh-based exception handling on win32, because it's patented.

Linking with pure C code worked for ages, so, you might workaround these C++ ABI-related issues via C stubs / wrappers.

like image 116
Anton Korobeynikov Avatar answered Oct 07 '22 03:10

Anton Korobeynikov