diff --git a/lld/MachO/DriverUtils.cpp b/lld/MachO/DriverUtils.cpp --- a/lld/MachO/DriverUtils.cpp +++ b/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 vec(argv.data(), argv.data() + argv.size()); + // Expand response files (arguments in the form of @) + // and then parse the argument again. + cl::ExpandResponseFiles(saver, cl::TokenizeGNUCommandLine, vec); opt::InputArgList args = ParseArgs(vec, missingIndex, missingCount); if (missingCount) diff --git a/lld/test/MachO/responsefile.test b/lld/test/MachO/responsefile.test new file mode 100644 --- /dev/null +++ b/lld/test/MachO/responsefile.test @@ -0,0 +1,4 @@ +# RUN: echo --help > %t.rsp + +# RUN: %lld @%t.rsp | FileCheck %s +CHECK: OVERVIEW: LLVM Linker