[LLVMdev] Windows question: Dozens of linker warnings and errors

Michael Spencer bigcheesegs at gmail.com
Wed May 23 18:37:02 PDT 2012


On Wed, May 23, 2012 at 6:12 PM, Mikael Lyngvig <mikael at lyngvig.org> wrote:
> Thanks for the quick reply.  I had a feeling that it was due to missing
> Windows support in clang++ and LLVM.
>
> """
> This is due to clang not understanding force_inline. These functions
> are defined in a header included from Windows.h, so it ends up getting
> a definition everywhere it is included.
> """
>
> How much work would it take to add support for force_inline?  Are there any
> plans for when/if it will be supported?  I don't know anything about
> force_inline, but I guess supporting it is a relatively simple matter.
>  After all, isn't a forced_inline construct similar to an inlined template
> method?  In the old MS-OMF days, we'd start talking about COMDATs and stuff
> like that, but I don't know how it is done nowadays.

It should be trivial. Clang already parses it. It just needs to get
hooked up to the attribute system, as we already support the gnu
version of it (I believe alwaysinline).

> """
> The rest of the issues are due to clang not supporting the Microsoft
> C++ ABI yet. To use clang on Windows for C++ code you will need to use
> it with MinGW as it provides libraries that use the GNU C++ ABI.
>
> """
> I guess this is quite a mouthful, but when do you roughly expect the
> Microsoft C++ ABI to be supported?  v4.0 or later?  Is there anything not
> too overwhelming and/or complex that I can do to speed up this process?

People are actively working on it, but I have no idea when it will be ready.

> I am asking these questions because I see myself as a wannabe client of the
> LLVM tools - I don't know much about code generation and I don't really want
> to know much about it, all I want to do is to make my own production
> language using LLVM as the portable (also to Windows/M$) backend.  My hope
> is that LLVM can save me the hassles of meddling around with assembler and
> so on, as I'd much rather spend my energy on my language.  But if the
> Windows support is broken, partial beyond use, or never to be finished up, I
> cannot use LLVM.  Then I'd have spend my energy on writing my own simple
> code generator, which would never generate code of a quality anywhere near
> LLVM.  Or, I could go ahead and do my own silly backend and then check up on
> LLVM in a couple of years, to see if the Windows support was matured.

LLVM already supports Windows quite well. The issue is clang and the
MS C++ ABI. If you are writing your own language that does not need to
interact with the C++ ABI then everything will be fine.

> By the way, I do have a background in linkers and compilers for Windows
> platforms, so if I can help with anything, I'll be glad to do so.  Just
> don't expect me to work miracles from day one because it has been almost 15
> years since I last worked with compilers and linkers.
>
> Perhaps I can contribute in the field of Windows support?   I once wrote a
> librarian for OMF (the ancient object file format used under DOS) and COFF.
>  I could probably add support for COFF archives to llvm-ar, if need be.  And
> stuff like that.

Increasing support for Windows across LLVM is a welcome addition. My
main area on LLVM currently is actually binary tools, and adding
object file support to llvm-ar is one of the items on my list. You may
also be interested in the lld linker project (lld.llvm.org).

> Sincerely,
> Mikael

- Michael Spencer




More information about the llvm-dev mailing list