summaryrefslogtreecommitdiff
path: root/COFF/Driver.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'COFF/Driver.cpp')
-rw-r--r--COFF/Driver.cpp35
1 files changed, 20 insertions, 15 deletions
diff --git a/COFF/Driver.cpp b/COFF/Driver.cpp
index dc3a00ba55ed..4dabd9ebcc6d 100644
--- a/COFF/Driver.cpp
+++ b/COFF/Driver.cpp
@@ -25,6 +25,7 @@
#include "llvm/Support/Debug.h"
#include "llvm/Support/Path.h"
#include "llvm/Support/Process.h"
+#include "llvm/Support/TarWriter.h"
#include "llvm/Support/TargetSelect.h"
#include "llvm/Support/raw_ostream.h"
#include <algorithm>
@@ -98,9 +99,9 @@ MemoryBufferRef LinkerDriver::takeBuffer(std::unique_ptr<MemoryBuffer> MB) {
MemoryBufferRef MBRef = *MB;
OwningMBs.push_back(std::move(MB));
- if (Driver->Cpio)
- Driver->Cpio->append(relativeToRoot(MBRef.getBufferIdentifier()),
- MBRef.getBuffer());
+ if (Driver->Tar)
+ Driver->Tar->append(relativeToRoot(MBRef.getBufferIdentifier()),
+ MBRef.getBuffer());
return MBRef;
}
@@ -368,7 +369,7 @@ static std::string createResponseFile(const opt::InputArgList &Args,
case OPT_libpath:
break;
default:
- OS << stringize(Arg) << "\n";
+ OS << toString(Arg) << "\n";
}
}
@@ -458,13 +459,17 @@ void LinkerDriver::link(ArrayRef<const char *> ArgsArr) {
if (auto *Arg = Args.getLastArg(OPT_linkrepro)) {
SmallString<64> Path = StringRef(Arg->getValue());
- sys::path::append(Path, "repro");
- ErrorOr<CpioFile *> F = CpioFile::create(Path);
- if (F)
- Cpio.reset(*F);
- else
- errs() << "/linkrepro: failed to open " << Path
- << ".cpio: " << F.getError().message() << '\n';
+ sys::path::append(Path, "repro.tar");
+
+ Expected<std::unique_ptr<TarWriter>> ErrOrWriter =
+ TarWriter::create(Path, "repro");
+
+ if (ErrOrWriter) {
+ Tar = std::move(*ErrOrWriter);
+ } else {
+ errs() << "/linkrepro: failed to open " << Path << ": "
+ << toString(ErrOrWriter.takeError()) << '\n';
+ }
}
if (Args.filtered_begin(OPT_INPUT) == Args.filtered_end())
@@ -683,10 +688,10 @@ void LinkerDriver::link(ArrayRef<const char *> ArgsArr) {
if (!Resources.empty())
addBuffer(convertResToCOFF(Resources));
- if (Cpio)
- Cpio->append("response.txt",
- createResponseFile(Args, FilePaths,
- ArrayRef<StringRef>(SearchPaths).slice(1)));
+ if (Tar)
+ Tar->append("response.txt",
+ createResponseFile(Args, FilePaths,
+ ArrayRef<StringRef>(SearchPaths).slice(1)));
// Handle /largeaddressaware
if (Config->is64() || Args.hasArg(OPT_largeaddressaware))