[lld] r271901 - Create version.txt in a reproduce archive file.
Rui Ueyama via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 6 08:34:39 PDT 2016
Author: ruiu
Date: Mon Jun 6 10:34:37 2016
New Revision: 271901
URL: http://llvm.org/viewvc/llvm-project?rev=271901&view=rev
Log:
Create version.txt in a reproduce archive file.
Differential Revision: http://reviews.llvm.org/D21008
Modified:
lld/trunk/ELF/Driver.cpp
lld/trunk/ELF/Driver.h
lld/trunk/ELF/DriverUtils.cpp
lld/trunk/test/ELF/reproduce.s
Modified: lld/trunk/ELF/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Driver.cpp?rev=271901&r1=271900&r2=271901&view=diff
==============================================================================
--- lld/trunk/ELF/Driver.cpp (original)
+++ lld/trunk/ELF/Driver.cpp Mon Jun 6 10:34:37 2016
@@ -248,7 +248,7 @@ void LinkerDriver::main(ArrayRef<const c
return;
}
if (Args.hasArg(OPT_version)) {
- printVersion();
+ outs() << getVersionString();
return;
}
@@ -256,8 +256,10 @@ void LinkerDriver::main(ArrayRef<const c
// 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()));
- if (Cpio)
+ if (Cpio) {
Cpio->append("response.txt", createResponseFile(Args));
+ Cpio->append("version.txt", getVersionString());
+ }
}
readConfigs(Args);
Modified: lld/trunk/ELF/Driver.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Driver.h?rev=271901&r1=271900&r2=271901&view=diff
==============================================================================
--- lld/trunk/ELF/Driver.h (original)
+++ lld/trunk/ELF/Driver.h Mon Jun 6 10:34:37 2016
@@ -95,7 +95,7 @@ private:
};
void printHelp(const char *Argv0);
-void printVersion();
+std::string getVersionString();
std::vector<uint8_t> parseHexstring(StringRef S);
std::string createResponseFile(const llvm::opt::InputArgList &Args);
Modified: lld/trunk/ELF/DriverUtils.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/DriverUtils.cpp?rev=271901&r1=271900&r2=271901&view=diff
==============================================================================
--- lld/trunk/ELF/DriverUtils.cpp (original)
+++ lld/trunk/ELF/DriverUtils.cpp Mon Jun 6 10:34:37 2016
@@ -80,12 +80,12 @@ void elf::printHelp(const char *Argv0) {
Table.PrintHelp(outs(), Argv0, "lld", false);
}
-void elf::printVersion() {
- outs() << "LLD " << getLLDVersion();
- std::string S = getLLDRepositoryVersion();
- if (!S.empty())
- outs() << " " << S;
- outs() << "\n";
+std::string elf::getVersionString() {
+ std::string Version = getLLDVersion();
+ std::string Repo = getLLDRepositoryVersion();
+ if (Repo.empty())
+ return "LLD " + Version + "\n";
+ return "LLD " + Version + " " + Repo + "\n";
}
// Converts a hex string (e.g. "0x123456") to a vector.
Modified: lld/trunk/test/ELF/reproduce.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/reproduce.s?rev=271901&r1=271900&r2=271901&view=diff
==============================================================================
--- lld/trunk/test/ELF/reproduce.s (original)
+++ lld/trunk/test/ELF/reproduce.s Mon Jun 6 10:34:37 2016
@@ -19,6 +19,9 @@
# RSP-NEXT: -shared
# RSP-NEXT: --as-needed
+# RUN: FileCheck %s --check-prefix=VERSION < repro/version.txt
+# VERSION: LLD
+
# 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
@@ -50,6 +53,7 @@
# RUN: cpio -t < repro2.cpio | FileCheck %s
# CHECK: repro2/response.txt
+# CHECK-NEXT: repro2/version.txt
# CHECK-NEXT: repro2/{{.*}}/dyn
# CHECK-NEXT: repro2/{{.*}}/ver
# CHECK-NEXT: repro2/{{.*}}/foo bar
More information about the llvm-commits
mailing list