summaryrefslogtreecommitdiffstats
path: root/contrib/llvm/lib/LibDriver/LibDriver.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/llvm/lib/LibDriver/LibDriver.cpp')
-rw-r--r--contrib/llvm/lib/LibDriver/LibDriver.cpp19
1 files changed, 9 insertions, 10 deletions
diff --git a/contrib/llvm/lib/LibDriver/LibDriver.cpp b/contrib/llvm/lib/LibDriver/LibDriver.cpp
index cb3278c..b33a22f 100644
--- a/contrib/llvm/lib/LibDriver/LibDriver.cpp
+++ b/contrib/llvm/lib/LibDriver/LibDriver.cpp
@@ -56,17 +56,13 @@ public:
}
-static std::string getOutputPath(llvm::opt::InputArgList *Args) {
+static std::string getOutputPath(llvm::opt::InputArgList *Args,
+ const llvm::NewArchiveIterator &FirstMember) {
if (auto *Arg = Args->getLastArg(OPT_out))
return Arg->getValue();
- for (auto *Arg : Args->filtered(OPT_INPUT)) {
- if (!StringRef(Arg->getValue()).endswith_lower(".obj"))
- continue;
- SmallString<128> Val = StringRef(Arg->getValue());
- llvm::sys::path::replace_extension(Val, ".lib");
- return Val.str();
- }
- llvm_unreachable("internal error");
+ SmallString<128> Val = FirstMember.getNew();
+ llvm::sys::path::replace_extension(Val, ".lib");
+ return Val.str();
}
static std::vector<StringRef> getSearchPaths(llvm::opt::InputArgList *Args,
@@ -144,7 +140,10 @@ int llvm::libDriverMain(llvm::ArrayRef<const char*> ArgsArr) {
}
std::pair<StringRef, std::error_code> Result =
- llvm::writeArchive(getOutputPath(&Args), Members, /*WriteSymtab=*/true);
+ llvm::writeArchive(getOutputPath(&Args, Members[0]), Members,
+ /*WriteSymtab=*/true, object::Archive::K_GNU,
+ /*Deterministic*/ true);
+
if (Result.second) {
if (Result.first.empty())
Result.first = ArgsArr[0];
OpenPOWER on IntegriCloud