Various Windows / Cross Compile to Windows fixes
authorMoritz Angermann <moritz.angermann@gmail.com>
Fri, 2 Mar 2018 19:19:58 +0000 (14:19 -0500)
committerBen Gamari <ben@smart-cactus.org>
Fri, 2 Mar 2018 20:41:04 +0000 (15:41 -0500)
- Adds quick-cross-ncg flavour.
- Fix windows wchar with `_s` for mingw
- Lookup windres, dllwrap and objdump
- Fix type.

Reviewers: bgamari, hvr, Phyx, erikd, simonmar

Reviewed By: bgamari

Subscribers: rwbarton, thomie, erikd, carter

Differential Revision: https://phabricator.haskell.org/D4430

configure.ac
libraries/base/cbits/Win32Utils.c
rts/PathUtils.c
rts/win32/OSMem.c

index 216f43f..1d3effb 100644 (file)
@@ -418,6 +418,10 @@ then
     AC_PATH_PROG([DllWrap],[dllwrap])
     AC_PATH_PROG([Windres],[windres])
     AC_PATH_PROG([Genlib],[genlib])
+else
+    AC_CHECK_TARGET_TOOL([Windres],[windres])
+    AC_CHECK_TARGET_TOOL([DllWrap],[dllwrap])
+    AC_CHECK_TARGET_TOOL([OBJDUMP],[objdump])
 fi
 
 DllWrapCmd="$DllWrap"
index ce7ce97..b33db04 100644 (file)
@@ -9,6 +9,8 @@
 #include "HsBase.h"
 #include <stdbool.h>
 #include <stdint.h>
+/* Using Secure APIs */
+#define MINGW_HAS_SECURE_API 1
 #include <wchar.h>
 #include <windows.h>
 
index 1b0b729..def3f7e 100644 (file)
@@ -7,6 +7,11 @@
 
 #include <libgen.h>
 #include <ctype.h>
+#if defined(mingw32_HOST_OS)
+/* Using Secure APIs */
+#define MINGW_HAS_SECURE_API 1
+#include <wchar.h>
+#endif
 
 pathchar* pathdup(pathchar *path)
 {
index c67b95b..534cd15 100644 (file)
@@ -458,7 +458,7 @@ void *osReserveHeapMemory (void *startAddress, W_ *len)
             sysErrorBelch(
                 "osReserveHeapMemory: VirtualAlloc MEM_RESERVE %llu bytes \
                 at address %p bytes failed",
-                len + MBLOCK_SIZE, startAddress);
+                *len + MBLOCK_SIZE, startAddress);
         }
         stg_exit(EXIT_FAILURE);
     }