mirror of
https://github.com/RPCSX/llvm.git
synced 2025-02-04 11:27:34 +00:00
Object: support empty UID/GID fields
Normal archives do not have empty UID/GID fields. However, the Microsoft Import library format is a customized archive (it just uses an alternate symbol index format). When the import library is constructed by lib.exe, the UID and GID fields are left empty. Do not abort on such an input. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@274528 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
25cd212829
commit
e88f1b3430
@ -69,14 +69,20 @@ sys::TimeValue ArchiveMemberHeader::getLastModified() const {
|
||||
|
||||
unsigned ArchiveMemberHeader::getUID() const {
|
||||
unsigned Ret;
|
||||
if (StringRef(UID, sizeof(UID)).rtrim(' ').getAsInteger(10, Ret))
|
||||
StringRef User = StringRef(UID, sizeof(UID)).rtrim(' ');
|
||||
if (User.empty())
|
||||
return 0;
|
||||
if (User.getAsInteger(10, Ret))
|
||||
llvm_unreachable("UID time not a decimal number.");
|
||||
return Ret;
|
||||
}
|
||||
|
||||
unsigned ArchiveMemberHeader::getGID() const {
|
||||
unsigned Ret;
|
||||
if (StringRef(GID, sizeof(GID)).rtrim(' ').getAsInteger(10, Ret))
|
||||
StringRef Group = StringRef(GID, sizeof(GID)).rtrim(' ');
|
||||
if (Group.empty())
|
||||
return 0;
|
||||
if (Group.getAsInteger(10, Ret))
|
||||
llvm_unreachable("GID time not a decimal number.");
|
||||
return Ret;
|
||||
}
|
||||
|
2
test/tools/llvm-ar/Inputs/msvc-import.lib
Normal file
2
test/tools/llvm-ar/Inputs/msvc-import.lib
Normal file
@ -0,0 +1,2 @@
|
||||
!<arch>
|
||||
library.dll/ 28800 0 0 `
|
3
test/tools/llvm-ar/empty-uid-gid.test
Normal file
3
test/tools/llvm-ar/empty-uid-gid.test
Normal file
@ -0,0 +1,3 @@
|
||||
RUN: llvm-ar tv %S/Inputs/msvc-import.lib | FileCheck %s
|
||||
|
||||
CHECK: --------- 0/0 0 1970-01-01 00:00:00.000000000 library.dll
|
Loading…
x
Reference in New Issue
Block a user