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

Reid Kleckner rnk at google.com
Mon Jan 13 17:32:52 PST 2014


On Sun, Jan 12, 2014 at 3:20 AM, Ruben Van Boxem
<vanboxem.ruben at gmail.com>wrote:

> 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.
>

Sounds good!


> 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?
>

Driver::getToolChain() in Driver.cpp


> 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'm not sure exactly what the question is.


> 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)
>

We have driver documentation?  I wasn't aware of it.  :)  I'd look at
clang/test/Driver for some of the existing header / library search tests.


> Thanks!
>
> Ruben
>
> PS: I'm not subscribed to cfe-dev, please CC me directly.
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20140113/6d3e47e2/attachment.html>


More information about the cfe-dev mailing list