diff options
author | Rui Ueyama <ruiu@google.com> | 2013-06-03 00:27:03 +0000 |
---|---|---|
committer | Rui Ueyama <ruiu@google.com> | 2013-06-03 00:27:03 +0000 |
commit | 891c0cd3c1c1f408d2478ef9c35fe152d2ba5c04 (patch) | |
tree | e960bd2817547e08ad6918c59bea71a04f613e36 /lib | |
parent | 85cc972a06690507a2660fccb198319b0402105f (diff) | |
download | external_llvm-891c0cd3c1c1f408d2478ef9c35fe152d2ba5c04.zip external_llvm-891c0cd3c1c1f408d2478ef9c35fe152d2ba5c04.tar.gz external_llvm-891c0cd3c1c1f408d2478ef9c35fe152d2ba5c04.tar.bz2 |
[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')
-rw-r--r-- | lib/Object/Archive.cpp | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/lib/Object/Archive.cpp b/lib/Object/Archive.cpp index 0e13d05..be35924 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") { |