summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2015-12-18 16:07:17 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2015-12-18 16:07:17 +0000
commit7a36355b21faec780a7050363b60727cfaa90d31 (patch)
treeab9e6614cab909e14987174e5baeb3b5f0226f94
parent6517b004b2d3c1982127d895fc56ce106d513fd3 (diff)
downloadbcm5719-llvm-7a36355b21faec780a7050363b60727cfaa90d31.tar.gz
bcm5719-llvm-7a36355b21faec780a7050363b60727cfaa90d31.zip
Handle archives with paths in the names.
We always create archives with just he filename as the member name, but other archives can put a more complicated path in there. This patches handles it by computing just the filename as we do when adding a new member. If storing the path is important for some reason, we should probably have an orthogonal option for doing that and do it for both old and new members. Fixes pr25877. llvm-svn: 256001
-rw-r--r--llvm/lib/Object/ArchiveWriter.cpp6
-rw-r--r--llvm/test/Object/Inputs/pr25877.libbin0 -> 774 bytes
-rw-r--r--llvm/test/Object/pr25877.test9
3 files changed, 13 insertions, 2 deletions
diff --git a/llvm/lib/Object/ArchiveWriter.cpp b/llvm/lib/Object/ArchiveWriter.cpp
index f207dfb0876..c7343fdc171 100644
--- a/llvm/lib/Object/ArchiveWriter.cpp
+++ b/llvm/lib/Object/ArchiveWriter.cpp
@@ -415,8 +415,10 @@ llvm::writeArchive(StringRef ArcName,
ErrorOr<uint32_t> Size = OldMember.getSize();
if (std::error_code EC = Size.getError())
return std::make_pair("", EC);
- printMemberHeader(Out, Kind, Thin, I.getName(), StringMapIndexIter,
- ModTime, UID, GID, Perms, Size.get());
+ StringRef FileName = I.getName();
+ printMemberHeader(Out, Kind, Thin, sys::path::filename(FileName),
+ StringMapIndexIter, ModTime, UID, GID, Perms,
+ Size.get());
}
if (!Thin)
diff --git a/llvm/test/Object/Inputs/pr25877.lib b/llvm/test/Object/Inputs/pr25877.lib
new file mode 100644
index 00000000000..401cbeb172a
--- /dev/null
+++ b/llvm/test/Object/Inputs/pr25877.lib
Binary files differ
diff --git a/llvm/test/Object/pr25877.test b/llvm/test/Object/pr25877.test
new file mode 100644
index 00000000000..c323d6259fa
--- /dev/null
+++ b/llvm/test/Object/pr25877.test
@@ -0,0 +1,9 @@
+; RUN: echo create %t.a > %t.mri
+; RUN: echo addlib %p/Inputs/pr25877.lib >> %t.mri
+; RUN: echo save >> %t.mri
+; RUN: echo end >> %t.mri
+
+; RUN: llvm-ar -M < %t.mri
+; RUN: llvm-ar t %t.a | FileCheck %s
+
+; CHECK: foo.obj
OpenPOWER on IntegriCloud