summaryrefslogtreecommitdiff
path: root/lib/Object
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2013-07-10 22:07:59 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2013-07-10 22:07:59 +0000
commita739759fca088d277cbb78e3fd4b359d68a1cbcb (patch)
treeb9a12c0db7ca60f62e90d0332ede3c0c90802573 /lib/Object
parent6911911e614c1da1957af5518a15c5605657b4e2 (diff)
downloadllvm-a739759fca088d277cbb78e3fd4b359d68a1cbcb.tar.gz
llvm-a739759fca088d277cbb78e3fd4b359d68a1cbcb.tar.bz2
llvm-a739759fca088d277cbb78e3fd4b359d68a1cbcb.tar.xz
Find the symbol table on archives created on OS X.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186041 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Object')
-rw-r--r--lib/Object/Archive.cpp17
1 files changed, 14 insertions, 3 deletions
diff --git a/lib/Object/Archive.cpp b/lib/Object/Archive.cpp
index 91cc4efde2..60c6d21f48 100644
--- a/lib/Object/Archive.cpp
+++ b/lib/Object/Archive.cpp
@@ -236,9 +236,9 @@ Archive::Archive(MemoryBuffer *source, error_code &ec)
// Second member : // (may exist, if it exists, points to the string table)
// Note : The string table is used if the filename exceeds 15 characters
// BSD archive format
- // First member : __.SYMDEF (points to the symbol table)
- // There is no string table, if the filename exceeds 15 characters or has a
- // embedded space, the filename has #1/<size>, The size represents the size
+ // First member : __.SYMDEF or "__.SYMDEF SORTED" (the symbol table)
+ // There is no string table, if the filename exceeds 15 characters or has a
+ // embedded space, the filename has #1/<size>, The size represents the size
// of the filename that needs to be read after the archive header
// COFF archive format
// First member : /
@@ -256,6 +256,17 @@ Archive::Archive(MemoryBuffer *source, error_code &ec)
return;
}
+ if (Name.startswith("#1/")) {
+ Format = K_BSD;
+ // We know this is BSD, so getName will work since there is no string table.
+ ec = i->getName(Name);
+ if (ec)
+ return;
+ if (Name == StringRef("__.SYMDEF SORTED\0\0\0", 20))
+ SymbolTable = i;
+ return;
+ }
+
if (Name == "/") {
SymbolTable = i;