summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Object/Archive.cpp
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
commitf4d0a8c13f7fdd8f87747067dc17af1cae03b118 (patch)
tree5e9315b5b832a8e7f16109b36cbb50c3645a5dc6 /llvm/lib/Object/Archive.cpp
parent774fe2e29a21815d7d107c00dc52a37eb91ecbc5 (diff)
downloadbcm5719-llvm-f4d0a8c13f7fdd8f87747067dc17af1cae03b118.tar.gz
bcm5719-llvm-f4d0a8c13f7fdd8f87747067dc17af1cae03b118.zip
[Object/COFF] Fix Windows .lib name handling.
llvm-svn: 183091
Diffstat (limited to 'llvm/lib/Object/Archive.cpp')
-rw-r--r--llvm/lib/Object/Archive.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/llvm/lib/Object/Archive.cpp b/llvm/lib/Object/Archive.cpp
index 0e13d0540fa..be359240626 100644
--- a/llvm/lib/Object/Archive.cpp
+++ b/llvm/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") {
OpenPOWER on IntegriCloud