[cfe-dev] Clang and (cross-)compilation to [i686, x86_64]-w64-mingw32

Ruben Van Boxem vanboxem.ruben at gmail.com
Sun Jan 12 03:20:23 PST 2014


Hi,

I'm planning to take a much-needed look at MinGW(-w64) compatibility in the
Clang driver. What I'm hoping to accomplish is the following:
1. allow 'clang -target [i686,x86_64]-w64-mingw32' to:
1a) search /usr/[i686,x86_64]-w64-mingw32/[include,lib] and certain
subdirectories for C(++) headers and libraries,
1b) use [i686,x86_64]-w64-mingw32-[as,ld,...] instead of what is currently
(as of Clang 3.3 in my Arch Linux installation, will soon test a top of
trunk build) [as,ld,...]
1c) set the necessary libraries to link in various situations.
2) Build a toolchain:
2a) that uses GNU binutils, Clang, and GNU libgcc/libstdc++ and make it
work.
2b) that uses GNU binutils, Clang, LLVM compiler-rt, and GNU libstdc++ and
make it work.

For this, I'd like to introduce a new Toolchain subclass, MinGWToolchain,
which takes care of the *-*-mingw32 triplets.

I'm unsure of several things:
1) where is the target triple "converted" into a Toolchain instance?
2) how can I pass triplet-specific include dirs at configure/cmake time?
This would not really be necessary, but actually really is if Clang is to
be used as an "ultra-cross"-compiler targetting every triplet under the sun
from one binary (which is an awesome idea).

I have read the sparse Driver documentation, and unfortunately not found an
answer to the above issues. I would appreciate any substantial help anyone
can give me in these departments. I'd like to do this right so the changes
can stay (unlike my previous InitHeaderSearch hacks)

Thanks!

Ruben

PS: I'm not subscribed to cfe-dev, please CC me directly.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20140112/a43ace02/attachment.html>


More information about the cfe-dev mailing list