[PATCH] Driver: generate file lists to pass through to linkers

Reid Kleckner rnk at google.com
Wed Jun 18 13:39:05 PDT 2014


Broadly, I'd like to rework this to be more generic.  We should have some mechanism in Support to get the max command line length.  The driver should have some mechanism for estimating if the command line will overflow that.  The Tool should query that, and if it is likely to overflow, go back and put parts of the command into filelists or generic response files.  If you really need to support a linker that only supports file lists, then we'll have to change the representation of the command line to be a list of strings that know if they are inputs or flags.  That seems OK.

================
Comment at: lib/Driver/Tools.cpp:180
@@ +179,3 @@
+  const char *CurrentFileListName;
+  std::ofstream CurrentFileList;
+  unsigned FileListSequence = 0;
----------------
Use llvm::raw_fd_ostream.  It has less moving parts.

================
Comment at: lib/Driver/Tools.cpp:213
@@ +212,3 @@
+        }
+        CurrentFileList << II.getFilename() << std::endl;
+      } else {
----------------
This won't be correct for many linkers if the filename contains whitespace.  I think we need to know what kind of linker we're calling out to in order to get this right.  It's easy for link.exe and gnu ld, since we know exactly how they quote and unquote arguments.  See the response file parsing code in llvm/lib/Support/CommandLine.cpp.

http://reviews.llvm.org/D4104






More information about the cfe-commits mailing list