COFF: Fix short import lib import name type bitshift

As per the PE COFF spec (section 8.3, Import Name Type)
Offset: 18 Size 2 bits Name: Type
Offset: 20 Size 3 bits Name: Name Type

Offset: 20 added based on 18+2

Partially commited as rL279069

Differential Revision: https://reviews.llvm.org/D23540

llvm-svn: 283055
This commit is contained in:
Martell Malone 2016-10-01 23:10:20 +00:00
parent 7609f1c269
commit 3a4d900039
3 changed files with 5 additions and 1 deletions

View File

@ -657,7 +657,7 @@ namespace COFF {
}
ImportNameType getNameType() const {
return static_cast<ImportNameType>((TypeInfo & 0x1C) >> 3);
return static_cast<ImportNameType>((TypeInfo & 0x1C) >> 2);
}
};

View File

@ -3,20 +3,24 @@ RUN: llvm-readobj -coff-exports %p/Inputs/library.lib | FileCheck %s
CHECK: File: library.dll
CHECK: Format: COFF-import-file
CHECK: Type: const
CHECK: Name type: undecorate
CHECK: Symbol: __imp__constant
CHECK: File: library.dll
CHECK: Format: COFF-import-file
CHECK: Type: data
CHECK: Name type: noprefix
CHECK: Symbol: __imp__data
CHECK: File: library.dll
CHECK: Format: COFF-import-file
CHECK: Type: code
CHECK: Name type: name
CHECK: Symbol: __imp__function
CHECK: File: library.dll
CHECK: Format: COFF-import-file
CHECK: Type: code
CHECK: Name type: ordinal
CHECK: Symbol: __imp__ordinal