summaryrefslogtreecommitdiffstats
path: root/lld/wasm/InputFiles.cpp
diff options
context:
space:
mode:
authorRui Ueyama <ruiu@google.com>2019-05-21 11:52:14 +0000
committerRui Ueyama <ruiu@google.com>2019-05-21 11:52:14 +0000
commit35150bb53417f9ac8ad93e573a057a266c84761e (patch)
tree6fa5664ce88ca8b40a2f50173b2a94a2883d3722 /lld/wasm/InputFiles.cpp
parentbc03bee66b3cd6d5fffca95334f729d0bd8f928f (diff)
downloadbcm5719-llvm-35150bb53417f9ac8ad93e573a057a266c84761e.tar.gz
bcm5719-llvm-35150bb53417f9ac8ad93e573a057a266c84761e.zip
[WebAssembly] Add --reproduce.
--reproduce is a convenient option for debugging. If you invoke lld with `--reproduce=repro.tar`, it creates `repro.tar` with all input files and the command line options given to the linker, so that it is very easy to run lld with the exact same inputs. ELF and Windows lld have this option. This patch add that option to lld/wasm. Differential Revision: https://reviews.llvm.org/D62170 llvm-svn: 361244
Diffstat (limited to 'lld/wasm/InputFiles.cpp')
-rw-r--r--lld/wasm/InputFiles.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/lld/wasm/InputFiles.cpp b/lld/wasm/InputFiles.cpp
index b53818ca4da..185a865dcab 100644
--- a/lld/wasm/InputFiles.cpp
+++ b/lld/wasm/InputFiles.cpp
@@ -14,8 +14,10 @@
#include "SymbolTable.h"
#include "lld/Common/ErrorHandler.h"
#include "lld/Common/Memory.h"
+#include "lld/Common/Reproduce.h"
#include "llvm/Object/Binary.h"
#include "llvm/Object/Wasm.h"
+#include "llvm/Support/TarWriter.h"
#include "llvm/Support/raw_ostream.h"
#define DEBUG_TYPE "lld"
@@ -27,6 +29,8 @@ using namespace llvm;
using namespace llvm::object;
using namespace llvm::wasm;
+std::unique_ptr<llvm::TarWriter> lld::wasm::Tar;
+
Optional<MemoryBufferRef> lld::wasm::readFile(StringRef Path) {
log("Loading: " + Path);
@@ -39,6 +43,8 @@ Optional<MemoryBufferRef> lld::wasm::readFile(StringRef Path) {
MemoryBufferRef MBRef = MB->getMemBufferRef();
make<std::unique_ptr<MemoryBuffer>>(std::move(MB)); // take MB ownership
+ if (Tar)
+ Tar->append(relativeToRoot(Path), MBRef.getBuffer());
return MBRef;
}
OpenPOWER on IntegriCloud