From 3a4d900039fda5ade30bfd99bccd76b14fbd1b8a Mon Sep 17 00:00:00 2001 From: Martell Malone Date: Sat, 1 Oct 2016 23:10:20 +0000 Subject: [PATCH] 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 --- llvm/include/llvm/Support/COFF.h | 2 +- .../tools/llvm-readobj/Inputs/library.lib | Bin 2166 -> 2166 bytes .../llvm-readobj/coff-exports-implib.test | 4 ++++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/llvm/include/llvm/Support/COFF.h b/llvm/include/llvm/Support/COFF.h index 7dad3e82bda6..1ca781b981e5 100644 --- a/llvm/include/llvm/Support/COFF.h +++ b/llvm/include/llvm/Support/COFF.h @@ -657,7 +657,7 @@ namespace COFF { } ImportNameType getNameType() const { - return static_cast((TypeInfo & 0x1C) >> 3); + return static_cast((TypeInfo & 0x1C) >> 2); } }; diff --git a/llvm/test/tools/llvm-readobj/Inputs/library.lib b/llvm/test/tools/llvm-readobj/Inputs/library.lib index 193380dd4858ce8cf4cc02298eeb4678a31f83ad..7ad7c9052ea82eaa9e628e6a9485d0d968879bd7 100755 GIT binary patch delta 19 bcmew+@J(QY0Xrk#WJC7jj4YFXveyCtMYsm4 delta 19 bcmew+@J(QY0XrktWJC7jj2x4HveyCtMW6<% diff --git a/llvm/test/tools/llvm-readobj/coff-exports-implib.test b/llvm/test/tools/llvm-readobj/coff-exports-implib.test index 9715109b3d52..2b327384b255 100644 --- a/llvm/test/tools/llvm-readobj/coff-exports-implib.test +++ b/llvm/test/tools/llvm-readobj/coff-exports-implib.test @@ -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