[commit: ghc] master: Various Windows / Cross Compile to Windows fixes (4a0d0d8)

git at git.haskell.org git at git.haskell.org
Fri Mar 2 21:07:53 UTC 2018


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/4a0d0d8062a204b867fc510c50e69a056ce7636f/ghc

>---------------------------------------------------------------

commit 4a0d0d8062a204b867fc510c50e69a056ce7636f
Author: Moritz Angermann <moritz.angermann at gmail.com>
Date:   Fri Mar 2 14:19:58 2018 -0500

    Various Windows / Cross Compile to Windows fixes
    
    - 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


>---------------------------------------------------------------

4a0d0d8062a204b867fc510c50e69a056ce7636f
 configure.ac                      | 4 ++++
 libraries/base/cbits/Win32Utils.c | 2 ++
 rts/PathUtils.c                   | 5 +++++
 rts/win32/OSMem.c                 | 2 +-
 4 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/configure.ac b/configure.ac
index 216f43f..1d3effb 100644
--- a/configure.ac
+++ b/configure.ac
@@ -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"
diff --git a/libraries/base/cbits/Win32Utils.c b/libraries/base/cbits/Win32Utils.c
index ce7ce97..b33db04 100644
--- a/libraries/base/cbits/Win32Utils.c
+++ b/libraries/base/cbits/Win32Utils.c
@@ -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>
 
diff --git a/rts/PathUtils.c b/rts/PathUtils.c
index 1b0b729..def3f7e 100644
--- a/rts/PathUtils.c
+++ b/rts/PathUtils.c
@@ -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)
 {
diff --git a/rts/win32/OSMem.c b/rts/win32/OSMem.c
index c67b95b..534cd15 100644
--- a/rts/win32/OSMem.c
+++ b/rts/win32/OSMem.c
@@ -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);
     }



More information about the ghc-commits mailing list