Created
October 1, 2016 12:20
-
-
Save martell/99e00b2f7c1e0bd954455f15a2cfab4f to your computer and use it in GitHub Desktop.
0001-COFF-Fix-short-import-lib-import-name-type-bitshift.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From bb716cb613551806c92d48b7a96c2cd7e76a7e06 Mon Sep 17 00:00:00 2001 | |
From: Martell Malone <martellmalone@gmail.com> | |
Date: Sat, 1 Oct 2016 09:37:25 +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 | |
diff --git a/include/llvm/Support/COFF.h b/include/llvm/Support/COFF.h | |
index 7dad3e8..1ca781b9 100644 | |
--- a/include/llvm/Support/COFF.h | |
+++ b/include/llvm/Support/COFF.h | |
@@ -657,7 +657,7 @@ namespace COFF { | |
} | |
ImportNameType getNameType() const { | |
- return static_cast<ImportNameType>((TypeInfo & 0x1C) >> 3); | |
+ return static_cast<ImportNameType>((TypeInfo & 0x1C) >> 2); | |
} | |
}; | |
diff --git a/test/tools/llvm-readobj/Inputs/library.lib b/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/test/tools/llvm-readobj/coff-exports-implib.test b/test/tools/llvm-readobj/coff-exports-implib.test | |
index 9715109..2b32738 100644 | |
--- a/test/tools/llvm-readobj/coff-exports-implib.test | |
+++ b/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 | |
-- | |
2.7.4 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment