<div dir="ltr">(prior art: <a href="http://reviews.llvm.org/D4104">http://reviews.llvm.org/D4104</a>)</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Aug 13, 2014 at 9:13 PM, Rafael Auler <span dir="ltr"><<a href="mailto:rafaelauler@gmail.com" target="_blank">rafaelauler@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi rafael, asl,<br>
<br>
This patch addresses PR15171 and teaches Clang how to call other tools with response files, when the command line exceeds system limits. This is a problem for Windows systems, whose maximum command-line length is 32kb.<br>

<br>
I introduce the concept of "response file support" for each Tool object. A given Tool may have full support for response files (e.g. MSVC's link.exe) or only support file names inside response files, but no flags (e.g. Apple's ld64, as commented in PR15171), or no support at all (the default case). Therefore, if you implement a toolchain in the clang driver and you want clang to be able to use response files in your tools, you must override a method (getReponseFileSupport()) to tell so.<br>

<br>
I designed it to support different kinds of tools and internationalisation needs:<br>
<br>
- VS response files ( UTF-16 )<br>
- GNU tools ( uses system's current code page, windows' legacy intl. support, with escaped backslashes. On unix, fallback to UTF-8 )<br>
- Clang itself ( UTF-16 on windows, UTF-8 on unix )<br>
- ld64 response files ( only a limited file list, UTF-8 on unix )<br>
<br>
With this design, I was able to test input file names with spaces and international characters for Windows. When the linker input is large enough, it creates a response file with the correct encoding. On a Mac, to test ld64, I temporarily changed Clang's behavior to always use response files regardless of the command size limit (avoiding using huge command line inputs). I tested clang with the LLVM test suite (compiling benchmarks) and it did fine.<br>

<br>
Note: It depends on <a href="http://reviews.llvm.org/D4896" target="_blank">http://reviews.llvm.org/D4896</a> landing in the LLVM tree.<br>
<br>
<a href="http://reviews.llvm.org/D4897" target="_blank">http://reviews.llvm.org/D4897</a><br>
<br>
Files:<br>
  include/clang/Driver/Compilation.h<br>
  include/clang/Driver/Job.h<br>
  include/clang/Driver/Tool.h<br>
  lib/Driver/Compilation.cpp<br>
  lib/Driver/Job.cpp<br>
  lib/Driver/Tools.cpp<br>
  lib/Driver/Tools.h<br>
  test/Driver/response-file.c<br>
<br>_______________________________________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@cs.uiuc.edu">cfe-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits</a><br>
<br></blockquote></div><br></div>