[PATCH] D47500: [WebAssembly] Add support for response file parsing

Sam Clegg via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 29 19:57:41 PDT 2018


sbc100 updated this revision to Diff 149027.
sbc100 added a comment.

- feedback


Repository:
  rLLD LLVM Linker

https://reviews.llvm.org/D47500

Files:
  test/wasm/responsefile.test
  wasm/Driver.cpp


Index: wasm/Driver.cpp
===================================================================
--- wasm/Driver.cpp
+++ wasm/Driver.cpp
@@ -144,6 +144,11 @@
   unsigned MissingCount;
   opt::InputArgList Args = this->ParseArgs(Vec, MissingIndex, MissingCount);
 
+  // Expand response files (arguments in the form of @<filename>)
+  // and then parse the argument again.
+  cl::ExpandResponseFiles(Saver, cl::TokenizeGNUCommandLine, Vec);
+  Args = this->ParseArgs(Vec, MissingIndex, MissingCount);
+
   handleColorDiagnostics(Args);
   for (auto *Arg : Args.filtered(OPT_UNKNOWN))
     error("unknown argument: " + Arg->getSpelling());
Index: test/wasm/responsefile.test
===================================================================
--- /dev/null
+++ test/wasm/responsefile.test
@@ -0,0 +1,11 @@
+RUN: llc -filetype=obj -o %t.o %p/Inputs/ret32.ll
+
+RUN: echo -o %t.wasm -e ret32 %t.o > %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 | \
+RUN:     FileCheck --check-prefix=ESCAPE %s
+ESCAPE: error: cannot open blahfoo: No such file or directory


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D47500.149027.patch
Type: text/x-patch
Size: 1196 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180530/fe0d747b/attachment.bin>


More information about the llvm-commits mailing list