aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Clegg <sbc@chromium.org>2018-05-30 03:51:56 +0000
committerSam Clegg <sbc@chromium.org>2018-05-30 03:51:56 +0000
commit96cfb2f9bfa096025338ddc14aa79b08b709ab0b (patch)
tree3f048e8a37b6fbe6794e1ad3a5b7b88384fb79cb
parent46679249f667e50e4a830f04a0cde3ea83fd8d4f (diff)
[WebAssembly] Add support for response file parsing
Differential Revision: https://reviews.llvm.org/D47500 git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@333499 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--test/wasm/responsefile.test10
-rw-r--r--wasm/Driver.cpp4
2 files changed, 14 insertions, 0 deletions
diff --git a/test/wasm/responsefile.test b/test/wasm/responsefile.test
new file mode 100644
index 000000000..d5e262c3b
--- /dev/null
+++ b/test/wasm/responsefile.test
@@ -0,0 +1,10 @@
+RUN: llc -filetype=obj -o %t.o %p/Inputs/ret32.ll
+
+RUN: echo "%t.o -o %t.wasm -e ret32" > %t.rsp
+RUN: wasm-ld @%t.rsp --initial-memory=655360
+RUN: llvm-readobj --sections %t.wasm | FileCheck %s
+CHECK: InitialPages: 10
+
+RUN: echo "blah\foo" > %t.rsp
+RUN: not wasm-ld @%t.rsp 2>&1 | FileCheck --check-prefix=ESCAPE %s
+ESCAPE: error: cannot open blahfoo: No such file or directory
diff --git a/wasm/Driver.cpp b/wasm/Driver.cpp
index 840ebce0f..f705c5d8d 100644
--- a/wasm/Driver.cpp
+++ b/wasm/Driver.cpp
@@ -142,6 +142,10 @@ opt::InputArgList WasmOptTable::parse(ArrayRef<const char *> Argv) {
unsigned MissingIndex;
unsigned MissingCount;
+
+ // Expand response files (arguments in the form of @<filename>)
+ cl::ExpandResponseFiles(Saver, cl::TokenizeGNUCommandLine, Vec);
+
opt::InputArgList Args = this->ParseArgs(Vec, MissingIndex, MissingCount);
handleColorDiagnostics(Args);