[mac/lld] Add support for response files

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

Differential Revision: https://reviews.llvm.org/D92149
This commit is contained in:
Nico Weber
2020-11-25 21:48:27 -05:00
parent 686988a50f
commit d20abb1ec3
2 changed files with 8 additions and 0 deletions

View File

@@ -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 @@ opt::InputArgList MachOOptTable::parse(ArrayRef<const char *> argv) {
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)

View File

@@ -0,0 +1,4 @@
# RUN: echo --help > %t.rsp
# RUN: %lld @%t.rsp | FileCheck %s
CHECK: OVERVIEW: LLVM Linker