summaryrefslogtreecommitdiff
path: root/ELF/Driver.cpp
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2017-01-06 20:14:02 +0000
committerDimitry Andric <dim@FreeBSD.org>2017-01-06 20:14:02 +0000
commitc09ce7fd2d62d85dcdf370f4bef732380fca4f1b (patch)
treedd5cf05b9ae703e6fb816b9663d4a0c903e0c2c6 /ELF/Driver.cpp
parent5d4d137132d719d0d20d119375b205d6a2c721ee (diff)
Notes
Diffstat (limited to 'ELF/Driver.cpp')
-rw-r--r--ELF/Driver.cpp25
1 files changed, 14 insertions, 11 deletions
diff --git a/ELF/Driver.cpp b/ELF/Driver.cpp
index a11dbc7cc47f..6afbe62e5ec7 100644
--- a/ELF/Driver.cpp
+++ b/ELF/Driver.cpp
@@ -25,6 +25,7 @@
#include "llvm/ADT/StringExtras.h"
#include "llvm/ADT/StringSwitch.h"
#include "llvm/Support/CommandLine.h"
+#include "llvm/Support/Path.h"
#include "llvm/Support/TargetSelect.h"
#include "llvm/Support/raw_ostream.h"
#include <cstdlib>
@@ -182,8 +183,8 @@ Optional<MemoryBufferRef> LinkerDriver::readFile(StringRef Path) {
MemoryBufferRef MBRef = MB->getMemBufferRef();
make<std::unique_ptr<MemoryBuffer>>(std::move(MB)); // take MB ownership
- if (Cpio)
- Cpio->append(relativeToRoot(Path), MBRef.getBuffer());
+ if (Tar)
+ Tar->append(relativeToRoot(Path), MBRef.getBuffer());
return MBRef;
}
@@ -309,14 +310,16 @@ void LinkerDriver::main(ArrayRef<const char *> ArgsArr, bool CanExitEarly) {
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.
- ErrorOr<CpioFile *> F = CpioFile::create(Path);
- if (F) {
- Cpio.reset(*F);
- Cpio->append("response.txt", createResponseFile(Args));
- Cpio->append("version.txt", getLLDVersion() + "\n");
- } else
- error(F.getError(),
- Twine("--reproduce: failed to open ") + Path + ".cpio");
+ Expected<std::unique_ptr<TarWriter>> ErrOrWriter =
+ TarWriter::create(Path, path::stem(Path));
+ if (ErrOrWriter) {
+ Tar = std::move(*ErrOrWriter);
+ Tar->append("response.txt", createResponseFile(Args));
+ Tar->append("version.txt", getLLDVersion() + "\n");
+ } else {
+ error(Twine("--reproduce: failed to open ") + Path + ": " +
+ toString(ErrOrWriter.takeError()));
+ }
}
readConfigs(Args);
@@ -423,7 +426,7 @@ static uint64_t parseSectionAddress(StringRef S, opt::Arg *Arg) {
if (S.startswith("0x"))
S = S.drop_front(2);
if (S.getAsInteger(16, VA))
- error("invalid argument: " + stringize(Arg));
+ error("invalid argument: " + toString(Arg));
return VA;
}