[PATCH] D21628: [ELF] Allow --reproduce to be specified as an env variable
Davide Italiano via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 22 16:15:22 PDT 2016
davide created this revision.
davide added reviewers: ruiu, rafael.
davide added subscribers: silvas, llvm-commits.
For context:
https://llvm.org/bugs/show_bug.cgi?id=28257
http://reviews.llvm.org/D21628
Files:
ELF/Driver.cpp
test/ELF/reproduce.s
Index: test/ELF/reproduce.s
===================================================================
--- test/ELF/reproduce.s
+++ test/ELF/reproduce.s
@@ -25,7 +25,7 @@
# RUN: mkdir -p %t.dir/build2/a/b/c
# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.dir/build2/foo.o
# RUN: cd %t.dir/build2/a/b/c
-# RUN: ld.lld ./../../../foo.o -o bar -shared --as-needed --reproduce repro
+# RUN: env LLD_REPRODUCE=repro ld.lld ./../../../foo.o -o bar -shared --as-needed
# RUN: cpio -id < repro.cpio
# RUN: diff %t.dir/build2/foo.o repro/%:t.dir/build2/foo.o
Index: ELF/Driver.cpp
===================================================================
--- ELF/Driver.cpp
+++ ELF/Driver.cpp
@@ -23,6 +23,7 @@
#include "llvm/ADT/StringSwitch.h"
#include "llvm/Support/TargetSelect.h"
#include "llvm/Support/raw_ostream.h"
+#include <cstdlib>
#include <utility>
using namespace llvm;
@@ -253,10 +254,15 @@
return;
}
- if (auto *Arg = Args.getLastArg(OPT_reproduce)) {
+ const char *ReproducePath = nullptr;
+ if (Args.hasArg(OPT_reproduce))
+ ReproducePath = Args.getLastArg(OPT_reproduce)->getValue();
+ else
+ ReproducePath = ::getenv("LLD_REPRODUCE");
+ if (ReproducePath) {
// Note that --reproduce is a debug option so you can ignore it
// if you are trying to understand the whole picture of the code.
- Cpio.reset(CpioFile::create(Arg->getValue()));
+ Cpio.reset(CpioFile::create(ReproducePath));
if (Cpio) {
Cpio->append("response.txt", createResponseFile(Args));
Cpio->append("version.txt", getVersionString());
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D21628.61623.patch
Type: text/x-patch
Size: 1588 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160622/44160010/attachment.bin>
More information about the llvm-commits
mailing list