<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">2014/1/16 Nikola Smiljanic <span dir="ltr"><<a href="mailto:popizdeh@gmail.com" target="_blank">popizdeh@gmail.com</a>></span><br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div dir="ltr">Hi Ruben, I'd just like to point you to test/Driver/linux-header-search.cpp for some testing ideas. I could also give this a try on windows if you're only testing on linux?</div><div class="gmail_extra">
<br><br><div class="gmail_quote"><div><div class="h5">On Thu, Jan 16, 2014 at 9:16 AM, Ruben Van Boxem <span dir="ltr"><<a href="mailto:vanboxem.ruben@gmail.com" target="_blank">vanboxem.ruben@gmail.com</a>></span> wrote:<br>
</div></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div><div class="h5">
<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div>2014/1/14 Reid Kleckner <span dir="ltr"><<a href="mailto:rnk@google.com" target="_blank">rnk@google.com</a>></span><br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div dir="ltr"><div><div class="gmail_extra">On Sun, Jan 12, 2014 at 3:20 AM, Ruben Van Boxem <span dir="ltr"><<a href="mailto:vanboxem.ruben@gmail.com" target="_blank">vanboxem.ruben@gmail.com</a>></span> wrote:<br>
</div>
</div><div class="gmail_extra"><div class="gmail_quote"><div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">
<div><div><div>Hi,<br><br></div>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:<br></div>1. allow 'clang -target [i686,x86_64]-w64-mingw32' to:<br>
1a) search /usr/[i686,x86_64]-w64-mingw32/[include,lib] and certain subdirectories for C(++) headers and libraries,<br></div><div>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,...]<br>
</div><div>1c) set the necessary libraries to link in various situations.<br></div><div>2) Build a toolchain:<br>2a) that uses GNU binutils, Clang, and GNU libgcc/libstdc++ and make it work.<br></div><div>2b) that uses GNU binutils, Clang, LLVM compiler-rt, and GNU libstdc++ and make it work.<br>
</div></div></blockquote><div><br></div></div><div>Sounds good! </div><div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div dir="ltr"><div></div><div>For this, I'd like to introduce a new Toolchain subclass, MinGWToolchain, which takes care of the *-*-mingw32 triplets.<br><br></div><div>I'm unsure of several things:<br></div><div>
1) where is the target triple "converted" into a Toolchain instance?<br></div></div></blockquote><div><br></div></div><div>Driver::getToolChain() in Driver.cpp</div></div></div></div></blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div dir="ltr"><div class="gmail_extra">
<div class="gmail_quote"><div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div dir="ltr"><div>
</div><div>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).<br>
</div></div></blockquote><div><br></div></div><div>I'm not sure exactly what the question is.</div></div></div></div></blockquote><div><br></div></div><div>I was talking about the<code> --with-c-include-dirs</code> and associated configure options. But I now believe my MinGWToolChain and related work will include these settings hardcoded in the driver, which is much better. So forget this question :-)<br>
<br></div><div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div><div>
</div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div dir="ltr"><div></div><div>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)<br>
</div></div></blockquote><div><br></div></div><div>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.</div></div></div>
</div></blockquote><div><br></div></div><div>OK, thanks. I'll be sure to take a look there.<br><br>Attached is a *preliminary* patch adding MinGW-w64 driver support. This includes:<br></div><div> - C(++) system include directories<br>
</div><div> - C(++) system libraries<br></div><div> - basic "Hello World" C and C++ test compiles and links on Arch Linux with the mingw-w64-gcc toolchain packages installed. Clang now calls the cross binutils directly instead of linking with cross gcc. <br>
</div><div><br></div><div>This patch is missing:<br></div><div> - more than basic testing (including a Windows native Clang, which will take some manual installation steps)<br></div><div> - dll import lib options,<br></div>
<div> - MinGW(.org) search directories. I'll get to this once I solve the next point;<br></div><div> - Cross GCC version detection: I know the Generic_GCC ToolChain has machinery to do this, but it also adds the /usr/include and /usr/local/include directories, and probably some native library directories which I really really don't want. Is there an easy way to get at the cross GCC version at the ToolChain level?<br>
</div></div></div></div></div></div></blockquote></div></div></blockquote><div><br></div><div>All the above, except MinGW.org search directories has been done. I opened up a bug report for this so the discussion on it can be localized there:<br>
<a href="http://llvm.org/bugs/show_bug.cgi?id=18546">http://llvm.org/bugs/show_bug.cgi?id=18546</a><br><br></div><div>Three things currently missing:<br></div><div> - proper fix for DllMainCRTStartup missing entry point<br>
</div><div> - MinGW.org search paths<br></div><div> - unit tests<br><br></div><div>I'd appreciate help in the last department, and if someone could test and provide any insight for the first one, I'd appreciate it. I'll get to the second one when I find the time.<br>
<br></div><div>Cheers!<br><br>Ruben<br></div><div><br><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div class="gmail_extra"><div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div><div class="h5"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div>
<br></div><div>Once I get the GCC version (which is hardcoded in attached patch), I'll fix up the rest and this should be ready in no time!<br><br></div><div>Another question for later: how do I build the libgcc replacing part of compiler-rt for a specific target? Is there CMake build machinery to build a number of target libraries or do I need to build them separately and manually (not really a problem, just need to know how)?<br>
</div><div><br></div><div>Cheers!<br><br></div><div><div>Ruben<br><br>PS: I'm not subscribed to cfe-dev, please CC me directly.</div></div></div></div></div>
<br></div></div><div class="im">_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@cs.uiuc.edu" target="_blank">cfe-dev@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev</a><br>
<br></div></blockquote></div><br></div>
</blockquote></div><br></div></div>