summaryrefslogtreecommitdiff
path: root/rts/linker
diff options
context:
space:
mode:
authorSergey Vinokurov <serg.foo@gmail.com>2017-08-21 00:40:08 +0300
committerTamar Christina <tamar@zhox.com>2017-08-21 17:22:49 +0100
commit34bd43d9c24207a1897aaa4ee6cb70592a3f7acc (patch)
tree3b3504e502647467c40ccfb77ef725e204fadd84 /rts/linker
parent1cdceb9fa3bc3ad01b2d840caad8e735513e14ed (diff)
downloadhaskell-34bd43d9c24207a1897aaa4ee6cb70592a3f7acc.tar.gz
Fix loading of dlls on 32bit windows
The point of fix is to handle case when loaded dll loads no other dlls, i.e. it's import table is empty. GHC Trac Issues: #14081
Diffstat (limited to 'rts/linker')
-rw-r--r--rts/linker/PEi386.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/rts/linker/PEi386.c b/rts/linker/PEi386.c
index 42e700805e..011b0a8314 100644
--- a/rts/linker/PEi386.c
+++ b/rts/linker/PEi386.c
@@ -240,6 +240,13 @@ static void addDLLHandle(pathchar* dll_name, HINSTANCE instance) {
(PIMAGE_IMPORT_DESCRIPTOR)((BYTE *)instance + header->
OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_IMPORT].VirtualAddress);
+ bool importTableMissing =
+ header->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_IMPORT].Size == 0;
+
+ if (importTableMissing) {
+ return;
+ }
+
/* Ignore these compatibility shims. */
const pathchar* ms_dll = WSTR("api-ms-win-");
const int len = wcslen(ms_dll);