[PATCH] D92149: [mac/lld] Add support for response files

Nico Weber via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 25 18:49:29 PST 2020


thakis created this revision.
thakis added a reviewer: int3.
thakis requested review of this revision.

ld64 learned about them in Xcode 12, so we should too.


https://reviews.llvm.org/D92149

Files:
  lld/MachO/DriverUtils.cpp
  lld/test/MachO/responsefile.test


Index: lld/test/MachO/responsefile.test
===================================================================
--- /dev/null
+++ lld/test/MachO/responsefile.test
@@ -0,0 +1,4 @@
+# RUN: echo --help > %t.rsp
+
+# RUN: %lld @%t.rsp | FileCheck %s
+CHECK: OVERVIEW: LLVM Linker
Index: lld/MachO/DriverUtils.cpp
===================================================================
--- lld/MachO/DriverUtils.cpp
+++ lld/MachO/DriverUtils.cpp
@@ -14,6 +14,7 @@
 #include "llvm/Option/Arg.h"
 #include "llvm/Option/ArgList.h"
 #include "llvm/Option/Option.h"
+#include "llvm/Support/CommandLine.h"
 #include "llvm/Support/Path.h"
 #include "llvm/TextAPI/MachO/TextAPIReader.h"
 
@@ -68,6 +69,9 @@
   unsigned missingCount;
   SmallVector<const char *, 256> vec(argv.data(), argv.data() + argv.size());
 
+  // Expand response files (arguments in the form of @<filename>)
+  // and then parse the argument again.
+  cl::ExpandResponseFiles(saver, cl::TokenizeGNUCommandLine, vec);
   opt::InputArgList args = ParseArgs(vec, missingIndex, missingCount);
 
   if (missingCount)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D92149.307745.patch
Type: text/x-patch
Size: 1064 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201126/32467445/attachment.bin>


More information about the llvm-commits mailing list