summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavide Italiano <davide@freebsd.org>2016-06-24 18:02:50 +0000
committerDavide Italiano <davide@freebsd.org>2016-06-24 18:02:50 +0000
commite160f0d0d6a65dc2361cd9d3d609916f420f81ca (patch)
tree60cbe7b60f57599320902e98da5e3c5dc5dae571
parent41583957a5abf9941187fc34ac89e031494118ad (diff)
downloadbcm5719-llvm-e160f0d0d6a65dc2361cd9d3d609916f420f81ca.tar.gz
bcm5719-llvm-e160f0d0d6a65dc2361cd9d3d609916f420f81ca.zip
[ELF] Allow --reproduce to be specified as an environment variable.
PR: 28257 Differential Revision: http://reviews.llvm.org/D21628 llvm-svn: 273698
-rw-r--r--lld/ELF/Driver.cpp11
-rw-r--r--lld/test/ELF/reproduce.s2
2 files changed, 10 insertions, 3 deletions
diff --git a/lld/ELF/Driver.cpp b/lld/ELF/Driver.cpp
index abb8efb25f0..f671107fb06 100644
--- a/lld/ELF/Driver.cpp
+++ b/lld/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;
@@ -234,6 +235,12 @@ static int getInteger(opt::InputArgList &Args, unsigned Key, int Default) {
return V;
}
+static const char *getReproduceOption(opt::InputArgList &Args) {
+ if (Args.hasArg(OPT_reproduce))
+ return Args.getLastArg(OPT_reproduce)->getValue();
+ return getenv("LLD_REPRODUCE");
+}
+
static bool hasZOption(opt::InputArgList &Args, StringRef Key) {
for (auto *Arg : Args.filtered(OPT_z))
if (Key == Arg->getValue())
@@ -253,10 +260,10 @@ void LinkerDriver::main(ArrayRef<const char *> ArgsArr) {
return;
}
- if (auto *Arg = Args.getLastArg(OPT_reproduce)) {
+ if (const char *Path = getReproduceOption(Args)) {
// 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(Path));
if (Cpio) {
Cpio->append("response.txt", createResponseFile(Args));
Cpio->append("version.txt", getVersionString());
diff --git a/lld/test/ELF/reproduce.s b/lld/test/ELF/reproduce.s
index ff21ded3957..9d256c12d82 100644
--- a/lld/test/ELF/reproduce.s
+++ b/lld/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
OpenPOWER on IntegriCloud