Soem more Wind64 fixes
authorIan Lynagh <igloo@earth.li>
Fri, 16 Mar 2012 23:03:02 +0000 (23:03 +0000)
committerIan Lynagh <igloo@earth.li>
Fri, 16 Mar 2012 23:03:02 +0000 (23:03 +0000)
We may need to do this differently once we get as far as building the
RTS in the dyn ways.

includes/RtsAPI.h
includes/stg/DLL.h
rts/Interpreter.c
rts/Linker.c
rts/StgMiscClosures.cmm

index e3b3f7d..7f41ebc 100644 (file)
@@ -232,7 +232,7 @@ SchedulerStatus rts_getSchedStatus (Capability *cap);
 //     Note that RtsAPI.h is also included by foreign export stubs in
 //     the base package itself.
 //
-#if defined(mingw32_HOST_OS) && defined(__PIC__) && !defined(COMPILING_BASE_PACKAGE)
+#if defined(mingw32_HOST_OS) && defined(i386_HOST_ARCH) && defined(__PIC__) && !defined(COMPILING_BASE_PACKAGE)
 __declspec(dllimport) extern StgWord base_GHCziTopHandler_runIO_closure[];
 __declspec(dllimport) extern StgWord base_GHCziTopHandler_runNonIO_closure[];
 #else
index 7d40960..b7030b0 100644 (file)
@@ -14,7 +14,7 @@
 #ifndef __STGDLL_H__
 #define __STGDLL_H__ 1
 
-#if defined(__PIC__) && defined(mingw32_HOST_OS)
+#if defined(__PIC__) && defined(mingw32_HOST_OS) && defined(i386_HOST_ARCH)
 #  define DLL_IMPORT_DATA_REF(x) (_imp__##x)
 #  define DLL_IMPORT_DATA_VARNAME(x) *_imp__##x
 #  if __GNUC__ && !defined(__declspec)
@@ -45,7 +45,7 @@
 #else
 #define DLL_IMPORT
 #define DLL_IMPORT_RTS DLLIMPORT
-# if defined(__PIC__) && defined(mingw32_HOST_OS)
+# if defined(__PIC__) && defined(mingw32_HOST_OS) && defined(i386_HOST_ARCH)
 #  define DLL_IMPORT_DATA_VAR(x) _imp__##x
 # else
 #  define DLL_IMPORT_DATA_VAR(x) x
index 2eac1cd..a18e7ca 100644 (file)
 // When building the RTS in the non-dyn way on Windows, we don't
 //     want declspec(__dllimport__) on the front of function prototypes
 //     from libffi.
-#if defined(mingw32_HOST_OS) && !defined(__PIC__)
+#if defined(mingw32_HOST_OS)
+#if (defined(i386_HOST_ARCH) && !defined(__PIC__)) || defined(x86_64_HOST_ARCH)
 # define LIBFFI_NOT_DLL
 #endif
+#endif
 
 #include "ffi.h"
 
index 9fb3f68..6fd36d8 100644 (file)
@@ -396,10 +396,7 @@ typedef struct _RtsSymbolVal {
       SymI_HasProto(utime)                               \
       SymI_HasProto(waitpid)
 
-#elif !defined(mingw32_HOST_OS)
-#define RTS_MINGW_ONLY_SYMBOLS /**/
-#define RTS_CYGWIN_ONLY_SYMBOLS /**/
-#else /* defined(mingw32_HOST_OS) */
+#elif defined(mingw32_HOST_OS)
 #define RTS_POSIX_ONLY_SYMBOLS  /**/
 #define RTS_CYGWIN_ONLY_SYMBOLS /**/
 
@@ -415,6 +412,12 @@ typedef struct _RtsSymbolVal {
 #define RTS___MINGW_VFPRINTF_SYM /**/
 #endif
 
+#if defined(i386_HOST_ARCH)
+#define RTS_MINGW32_ONLY(X) X
+#else
+#define RTS_MINGW32_ONLY(X) /**/
+#endif
+
 /* These are statically linked from the mingw libraries into the ghc
    executable, so we have to employ this hack. */
 #define RTS_MINGW_ONLY_SYMBOLS                           \
@@ -444,7 +447,7 @@ typedef struct _RtsSymbolVal {
       SymI_HasProto(strcpy)                              \
       SymI_HasProto(strncpy)                             \
       SymI_HasProto(abort)                               \
-      SymI_NeedsProto(_alloca)                           \
+      RTS_MINGW32_ONLY(SymI_NeedsProto(_alloca))         \
       SymI_HasProto(isxdigit)                            \
       SymI_HasProto(isupper)                             \
       SymI_HasProto(ispunct)                             \
@@ -495,21 +498,25 @@ typedef struct _RtsSymbolVal {
       SymI_HasProto(rts_InstallConsoleEvent)             \
       SymI_HasProto(rts_ConsoleHandlerDone)              \
       SymI_NeedsProto(mktime)                            \
-      SymI_NeedsProto(_imp___timezone)                   \
-      SymI_NeedsProto(_imp___tzname)                     \
-      SymI_NeedsProto(_imp__tzname)                      \
-      SymI_NeedsProto(_imp___iob)                        \
-      SymI_NeedsProto(_imp___osver)                      \
+      RTS_MINGW32_ONLY(SymI_NeedsProto(_imp___timezone)) \
+      RTS_MINGW32_ONLY(SymI_NeedsProto(_imp___tzname))   \
+      RTS_MINGW32_ONLY(SymI_NeedsProto(_imp__tzname))    \
+      RTS_MINGW32_ONLY(SymI_NeedsProto(_imp___iob))      \
+      RTS_MINGW32_ONLY(SymI_NeedsProto(_imp___osver))    \
       SymI_NeedsProto(localtime)                         \
       SymI_NeedsProto(gmtime)                            \
       SymI_NeedsProto(opendir)                           \
       SymI_NeedsProto(readdir)                           \
       SymI_NeedsProto(rewinddir)                         \
-      SymI_NeedsProto(_imp____mb_cur_max)                \
-      SymI_NeedsProto(_imp___pctype)                     \
-      SymI_NeedsProto(__chkstk)                          \
+      RTS_MINGW32_ONLY(SymI_NeedsProto(_imp____mb_cur_max)) \
+      RTS_MINGW32_ONLY(SymI_NeedsProto(_imp___pctype))   \
+      RTS_MINGW32_ONLY(SymI_NeedsProto(__chkstk))        \
       RTS_MINGW_GETTIMEOFDAY_SYM                         \
       SymI_NeedsProto(closedir)
+
+#else
+#define RTS_MINGW_ONLY_SYMBOLS /**/
+#define RTS_CYGWIN_ONLY_SYMBOLS /**/
 #endif
 
 
@@ -742,7 +749,7 @@ typedef struct _RtsSymbolVal {
 // We don't do this when compiling to Windows DLLs at the moment because
 //      it doesn't support cross package data references well.
 //
-#if defined(__PIC__) && defined(mingw32_HOST_OS)
+#if defined(__PIC__) && defined(mingw32_HOST_OS) && defined(i386_HOST_ARCH)
 #define RTS_INTCHAR_SYMBOLS
 #else
 #define RTS_INTCHAR_SYMBOLS                             \
@@ -1069,7 +1076,7 @@ typedef struct _RtsSymbolVal {
 
 /* entirely bogus claims about types of these symbols */
 #define SymI_NeedsProto(vvv)  extern void vvv(void);
-#if defined(__PIC__) && defined(mingw32_HOST_OS)
+#if defined(__PIC__) && defined(mingw32_HOST_OS) && defined(i386_HOST_ARCH)
 #define SymE_HasProto(vvv)    SymE_HasProto(vvv);
 #define SymE_NeedsProto(vvv)    extern void _imp__ ## vvv (void);
 #else
index e4b128f..763c85b 100644 (file)
@@ -576,7 +576,7 @@ INFO_TABLE_CONSTR(stg_MVAR_TSO_QUEUE,2,0,0,PRIM,"MVAR_TSO_QUEUE","MVAR_TSO_QUEUE
    replace them with references to the static objects.
    ------------------------------------------------------------------------- */
 
-#if defined(__PIC__) && defined(mingw32_HOST_OS)
+#if defined(__PIC__) && defined(mingw32_HOST_OS) && defined(i386_HOST_ARCH)
 /*
  * When sticking the RTS in a Windows DLL, we delay populating the
  * Charlike and Intlike tables until load-time, which is only
@@ -601,7 +601,7 @@ INFO_TABLE_CONSTR(stg_MVAR_TSO_QUEUE,2,0,0,PRIM,"MVAR_TSO_QUEUE","MVAR_TSO_QUEUE
  * on the fact that static closures live in the data section.
  */
 
-#if !(defined(__PIC__) && defined(mingw32_HOST_OS))
+#if !(defined(__PIC__) && defined(mingw32_HOST_OS) && defined(i386_HOST_ARCH))
 section "data" {
  stg_CHARLIKE_closure:
     CHARLIKE_HDR(0)
@@ -899,4 +899,4 @@ section "data" {
     INTLIKE_HDR(16)  /* MAX_INTLIKE == 16 */
 }
 
-#endif // !(defined(__PIC__) && defined(mingw32_HOST_OS))
+#endif // !(defined(__PIC__) && defined(mingw32_HOST_OS) && defined(i386_HOST_ARCH))