Skip to content

Commit d20abb1

Browse files
committed
[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
1 parent 686988a commit d20abb1

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

lld/MachO/DriverUtils.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#include "llvm/Option/Arg.h"
1515
#include "llvm/Option/ArgList.h"
1616
#include "llvm/Option/Option.h"
17+
#include "llvm/Support/CommandLine.h"
1718
#include "llvm/Support/Path.h"
1819
#include "llvm/TextAPI/MachO/TextAPIReader.h"
1920

@@ -68,6 +69,9 @@ opt::InputArgList MachOOptTable::parse(ArrayRef<const char *> argv) {
6869
unsigned missingCount;
6970
SmallVector<const char *, 256> vec(argv.data(), argv.data() + argv.size());
7071

72+
// Expand response files (arguments in the form of @<filename>)
73+
// and then parse the argument again.
74+
cl::ExpandResponseFiles(saver, cl::TokenizeGNUCommandLine, vec);
7175
opt::InputArgList args = ParseArgs(vec, missingIndex, missingCount);
7276

7377
if (missingCount)

lld/test/MachO/responsefile.test

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# RUN: echo --help > %t.rsp
2+
3+
# RUN: %lld @%t.rsp | FileCheck %s
4+
CHECK: OVERVIEW: LLVM Linker

0 commit comments

Comments
 (0)