[lld] r300612 - [coff] use newlines instead of spaces as separators in msvclto response file

Bob Haarman via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 18 15:00:29 PDT 2017


Author: inglorion
Date: Tue Apr 18 17:00:29 2017
New Revision: 300612

URL: http://llvm.org/viewvc/llvm-project?rev=300612&view=rev
Log:
[coff] use newlines instead of spaces as separators in msvclto response file

Summary:
Fixes PR32689: /msvclto creates response files with lines
that are too long for msvc's linker (LNK1170).

Reviewers: hans, rnk, ruiu

Subscribers: llvm-commits, mehdi_amini

Differential Revision: https://reviews.llvm.org/D32185

Modified:
    lld/trunk/COFF/Driver.cpp
    lld/trunk/COFF/DriverUtils.cpp

Modified: lld/trunk/COFF/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/Driver.cpp?rev=300612&r1=300611&r2=300612&view=diff
==============================================================================
--- lld/trunk/COFF/Driver.cpp (original)
+++ lld/trunk/COFF/Driver.cpp Tue Apr 18 17:00:29 2017
@@ -509,7 +509,7 @@ filterBitcodeFiles(StringRef Path, std::
 
 // Create response file contents and invoke the MSVC linker.
 void LinkerDriver::invokeMSVC(opt::InputArgList &Args) {
-  std::string Rsp = "/nologo ";
+  std::string Rsp = "/nologo\n";
   std::vector<std::string> Temps;
 
   for (auto *Arg : Args) {
@@ -528,14 +528,14 @@ void LinkerDriver::invokeMSVC(opt::Input
     case OPT_INPUT: {
       if (Optional<StringRef> Path = doFindFile(Arg->getValue())) {
         if (Optional<std::string> S = filterBitcodeFiles(*Path, Temps))
-          Rsp += quote(*S) + " ";
+          Rsp += quote(*S) + "\n";
         continue;
       }
-      Rsp += quote(Arg->getValue()) + " ";
+      Rsp += quote(Arg->getValue()) + "\n";
       break;
     }
     default:
-      Rsp += toString(Arg) + " ";
+      Rsp += toString(Arg) + "\n";
     }
   }
 

Modified: lld/trunk/COFF/DriverUtils.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/DriverUtils.cpp?rev=300612&r1=300611&r2=300612&view=diff
==============================================================================
--- lld/trunk/COFF/DriverUtils.cpp (original)
+++ lld/trunk/COFF/DriverUtils.cpp Tue Apr 18 17:00:29 2017
@@ -634,7 +634,7 @@ void runMSVCLinker(std::string Rsp, Arra
   std::vector<TemporaryFile> Temps;
   for (StringRef S : Objects) {
     Temps.emplace_back("lto", "obj", S);
-    Rsp += quote(Temps.back().Path) + " ";
+    Rsp += quote(Temps.back().Path) + "\n";
   }
 
   log("link.exe " + Rsp);




More information about the llvm-commits mailing list