summaryrefslogtreecommitdiff
path: root/lib/Object
diff options
context:
space:
mode:
authorRui Ueyama <ruiu@google.com>2013-06-03 00:27:03 +0000
committerRui Ueyama <ruiu@google.com>2013-06-03 00:27:03 +0000
commit891c0cd3c1c1f408d2478ef9c35fe152d2ba5c04 (patch)
treee960bd2817547e08ad6918c59bea71a04f613e36 /lib/Object
parent85cc972a06690507a2660fccb198319b0402105f (diff)
downloadllvm-891c0cd3c1c1f408d2478ef9c35fe152d2ba5c04.tar.gz
llvm-891c0cd3c1c1f408d2478ef9c35fe152d2ba5c04.tar.bz2
llvm-891c0cd3c1c1f408d2478ef9c35fe152d2ba5c04.tar.xz
[Object/COFF] Fix Windows .lib name handling.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183091 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Object')
-rw-r--r--lib/Object/Archive.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/lib/Object/Archive.cpp b/lib/Object/Archive.cpp
index 0e13d0540f..be35924062 100644
--- a/lib/Object/Archive.cpp
+++ b/lib/Object/Archive.cpp
@@ -132,8 +132,11 @@ Archive::Archive(MemoryBuffer *source, error_code &ec)
// COFF archive format
// First member : /
// Second member : / (provides a directory of symbols)
- // Third member : // contains the string table, this is present even if the
- // string table is empty
+ // Third member : // (may exist, if it exists, contains the string table)
+ // Note: Microsoft PE/COFF Spec 8.3 says that the third member is present
+ // even if the string table is empty. However, lib.exe does not in fact
+ // seem to create the third member if there's no member whose filename
+ // exceeds 15 characters. So the third member is optional.
if (name == "/") {
SymbolTable = i;
StringTable = e;
@@ -150,14 +153,17 @@ Archive::Archive(MemoryBuffer *source, error_code &ec)
Format = K_GNU;
StringTable = i;
++i;
- } else {
+ } else {
Format = K_COFF;
if (i != e) {
SymbolTable = i;
++i;
}
if (i != e) {
- StringTable = i;
+ if ((ec = i->getName(name)))
+ return;
+ if (name == "//")
+ StringTable = i;
}
}
} else if (name == "__.SYMDEF") {