forked from OSchip/llvm-project
ELF2: Support reponse files.
http://reviews.llvm.org/D13148 llvm-svn: 248575
This commit is contained in:
parent
d1f06aecc0
commit
eeb22f8251
|
@ -28,6 +28,9 @@ class ArgParser {
|
|||
public:
|
||||
// Parses command line options.
|
||||
llvm::opt::InputArgList parse(ArrayRef<const char *> Args);
|
||||
|
||||
private:
|
||||
llvm::BumpPtrAllocator Alloc;
|
||||
};
|
||||
|
||||
class LinkerDriver {
|
||||
|
|
|
@ -16,6 +16,8 @@
|
|||
#include "Driver.h"
|
||||
#include "Error.h"
|
||||
#include "llvm/ADT/STLExtras.h"
|
||||
#include "llvm/Support/CommandLine.h"
|
||||
#include "llvm/Support/StringSaver.h"
|
||||
|
||||
using namespace llvm;
|
||||
|
||||
|
@ -53,7 +55,13 @@ opt::InputArgList ArgParser::parse(ArrayRef<const char *> Argv) {
|
|||
unsigned MissingIndex;
|
||||
unsigned MissingCount;
|
||||
|
||||
opt::InputArgList Args = Table.ParseArgs(Argv, MissingIndex, MissingCount);
|
||||
// Expand response files. '@<filename>' is replaced by the file's contents.
|
||||
SmallVector<const char *, 256> Vec(Argv.data(), Argv.data() + Argv.size());
|
||||
StringSaver Saver(Alloc);
|
||||
llvm::cl::ExpandResponseFiles(Saver, llvm::cl::TokenizeGNUCommandLine, Vec);
|
||||
|
||||
// Parse options and then do error checking.
|
||||
opt::InputArgList Args = Table.ParseArgs(Vec, MissingIndex, MissingCount);
|
||||
if (MissingCount)
|
||||
error(Twine("missing arg value for \"") + Args.getArgString(MissingIndex) +
|
||||
"\", expected " + Twine(MissingCount) +
|
||||
|
|
|
@ -176,6 +176,11 @@ _start:
|
|||
# CHECK-NEXT: }
|
||||
# CHECK-NEXT: ]
|
||||
|
||||
# RUN: echo " -o %t2" > %t.responsefile
|
||||
# RUN: lld -flavor gnu2 %t @%t.responsefile
|
||||
# RUN: llvm-readobj -file-headers -sections -program-headers -symbols %t2 \
|
||||
# RUN: | FileCheck %s
|
||||
|
||||
# RUN: not lld -flavor gnu2 %t 2>&1 | FileCheck --check-prefix=NO_O %s
|
||||
# NO_O: -o must be specified.
|
||||
|
||||
|
|
Loading…
Reference in New Issue