diff options
author | Ian Lynagh <igloo@earth.li> | 2012-05-06 02:21:17 +0100 |
---|---|---|
committer | Ian Lynagh <igloo@earth.li> | 2012-05-06 02:21:17 +0100 |
commit | 5872bf5965d591536d7d9c9f9023c4966ac6ec31 (patch) | |
tree | b094059aae7dcdfc3ffa873c4e923a2db8141021 | |
parent | 6dcf001264e1488b7b3e61c332ba0f26816f4f03 (diff) | |
download | haskell-5872bf5965d591536d7d9c9f9023c4966ac6ec31.tar.gz |
Working towards fixing DLLs on Win64
-rw-r--r-- | includes/RtsAPI.h | 2 | ||||
-rw-r--r-- | includes/stg/DLL.h | 4 | ||||
-rw-r--r-- | rts/Linker.c | 4 | ||||
-rw-r--r-- | rts/RetainerProfile.c | 4 | ||||
-rw-r--r-- | rts/RtsDllMain.c | 4 | ||||
-rw-r--r-- | rts/RtsDllMain.h | 2 | ||||
-rw-r--r-- | rts/StgMiscClosures.cmm | 6 | ||||
-rw-r--r-- | rts/ghc.mk | 6 | ||||
-rw-r--r-- | rts/sm/Evac.c | 2 | ||||
-rw-r--r-- | rts/sm/Scav.c | 2 | ||||
-rw-r--r-- | rts/win32/ThrIOManager.c | 2 |
11 files changed, 22 insertions, 16 deletions
diff --git a/includes/RtsAPI.h b/includes/RtsAPI.h index 7f41ebc421..ca87662eb4 100644 --- a/includes/RtsAPI.h +++ b/includes/RtsAPI.h @@ -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(i386_HOST_ARCH) && defined(__PIC__) && !defined(COMPILING_BASE_PACKAGE) +#if defined(COMPILING_WINDOWS_DLL) && !defined(COMPILING_BASE_PACKAGE) __declspec(dllimport) extern StgWord base_GHCziTopHandler_runIO_closure[]; __declspec(dllimport) extern StgWord base_GHCziTopHandler_runNonIO_closure[]; #else diff --git a/includes/stg/DLL.h b/includes/stg/DLL.h index b7030b0e88..ec64404e62 100644 --- a/includes/stg/DLL.h +++ b/includes/stg/DLL.h @@ -14,7 +14,7 @@ #ifndef __STGDLL_H__ #define __STGDLL_H__ 1 -#if defined(__PIC__) && defined(mingw32_HOST_OS) && defined(i386_HOST_ARCH) +#if defined(COMPILING_WINDOWS_DLL) # 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) && defined(i386_HOST_ARCH) +# if defined(COMPILING_WINDOWS_DLL) # define DLL_IMPORT_DATA_VAR(x) _imp__##x # else # define DLL_IMPORT_DATA_VAR(x) x diff --git a/rts/Linker.c b/rts/Linker.c index ae77e6867a..26f734c758 100644 --- a/rts/Linker.c +++ b/rts/Linker.c @@ -986,7 +986,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) && defined(i386_HOST_ARCH) +#if defined(COMPILING_WINDOWS_DLL) #define RTS_INTCHAR_SYMBOLS #else #define RTS_INTCHAR_SYMBOLS \ @@ -1314,7 +1314,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) && defined(i386_HOST_ARCH) +#if defined(COMPILING_WINDOWS_DLL) #define SymE_HasProto(vvv) SymE_HasProto(vvv); #define SymE_NeedsProto(vvv) extern void _imp__ ## vvv (void); #else diff --git a/rts/RetainerProfile.c b/rts/RetainerProfile.c index 028b3e335a..4bbc3380ae 100644 --- a/rts/RetainerProfile.c +++ b/rts/RetainerProfile.c @@ -366,7 +366,7 @@ find_srt( stackPos *info ) bitmap = info->next.srt.srt_bitmap; while (bitmap != 0) { if ((bitmap & 1) != 0) { -#if defined(__PIC__) && defined(mingw32_HOST_OS) +#if defined(COMPILING_WINDOWS_DLL) if ((unsigned long)(*(info->next.srt.srt)) & 0x1) c = (* (StgClosure **)((unsigned long)*(info->next.srt.srt)) & ~0x1); else @@ -1235,7 +1235,7 @@ retainSRT (StgClosure **srt, nat srt_bitmap, StgClosure *c, retainer c_child_r) while (bitmap != 0) { if ((bitmap & 1) != 0) { -#if defined(__PIC__) && defined(mingw32_HOST_OS) +#if defined(COMPILING_WINDOWS_DLL) if ( (unsigned long)(*srt) & 0x1 ) { retainClosure(* (StgClosure**) ((unsigned long) (*srt) & ~0x1), c, c_child_r); diff --git a/rts/RtsDllMain.c b/rts/RtsDllMain.c index 2081e621a9..06c565588f 100644 --- a/rts/RtsDllMain.c +++ b/rts/RtsDllMain.c @@ -16,7 +16,7 @@ #endif /* I'd be mildly surprised if this wasn't defined, but still. */ -#if defined(__PIC__) && defined(mingw32_HOST_OS) +#if defined(COMPILING_WINDOWS_DLL) BOOL WINAPI DllMain ( HINSTANCE hInstance STG_UNUSED @@ -40,4 +40,4 @@ DllMain ( HINSTANCE hInstance STG_UNUSED return TRUE; } -#endif /* defined(__PIC__) && defined(mingw32_HOST_OS) */ +#endif diff --git a/rts/RtsDllMain.h b/rts/RtsDllMain.h index fc28d90f25..d781127079 100644 --- a/rts/RtsDllMain.h +++ b/rts/RtsDllMain.h @@ -6,7 +6,7 @@ #endif /* I'd be mildly surprised if this wasn't defined, but still. */ -#if defined(__PIC__) && defined(mingw32_HOST_OS) +#if defined(COMPILING_WINDOWS_DLL) BOOL WINAPI DllMain ( HINSTANCE hInstance diff --git a/rts/StgMiscClosures.cmm b/rts/StgMiscClosures.cmm index 763c85b3b6..b99126187a 100644 --- a/rts/StgMiscClosures.cmm +++ b/rts/StgMiscClosures.cmm @@ -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) && defined(i386_HOST_ARCH) +#if defined(COMPILING_WINDOWS_DLL) /* * 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) && defined(i386_HOST_ARCH)) +#if !(defined(COMPILING_WINDOWS_DLL)) 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) && defined(i386_HOST_ARCH)) +#endif diff --git a/rts/ghc.mk b/rts/ghc.mk index 70a7330cd8..5ae6b1ac3b 100644 --- a/rts/ghc.mk +++ b/rts/ghc.mk @@ -134,6 +134,12 @@ rts_dist_$1_HC_OPTS = $$(GhcRtsHcOpts) rts_dist_$1_CC_OPTS = $$(GhcRtsCcOpts) endif +ifneq "$$(findstring dyn, $1)" "" +ifeq "$$(HostOS_CPP)" "mingw32" +rts_dist_$1_CC_OPTS += -DCOMPILING_WINDOWS_DLL +endif +endif + ifneq "$$(findstring thr, $1)" "" rts_$1_EXTRA_C_SRCS = rts/dist/build/sm/Evac_thr.c rts/dist/build/sm/Scav_thr.c endif diff --git a/rts/sm/Evac.c b/rts/sm/Evac.c index fdb5477a38..20a5b098c2 100644 --- a/rts/sm/Evac.c +++ b/rts/sm/Evac.c @@ -555,7 +555,7 @@ loop: // case CONSTR_0_1: { -#if defined(__PIC__) && defined(mingw32_HOST_OS) +#if defined(COMPILING_WINDOWS_DLL) copy_tag_nolock(p,info,q,sizeofW(StgHeader)+1,gen_no,tag); #else StgWord w = (StgWord)q->payload[0]; diff --git a/rts/sm/Scav.c b/rts/sm/Scav.c index 881d4270c9..e7e02e6c99 100644 --- a/rts/sm/Scav.c +++ b/rts/sm/Scav.c @@ -313,7 +313,7 @@ scavenge_srt (StgClosure **srt, nat srt_bitmap) while (bitmap != 0) { if ((bitmap & 1) != 0) { -#if defined(__PIC__) && defined(mingw32_HOST_OS) +#if defined(COMPILING_WINDOWS_DLL) // Special-case to handle references to closures hiding out in DLLs, since // double indirections required to get at those. The code generator knows // which is which when generating the SRT, so it stores the (indirect) diff --git a/rts/win32/ThrIOManager.c b/rts/win32/ThrIOManager.c index 9561ea6aea..234d4dcfe4 100644 --- a/rts/win32/ThrIOManager.c +++ b/rts/win32/ThrIOManager.c @@ -152,7 +152,7 @@ ioManagerStart (void) Capability *cap;
if (io_manager_event == INVALID_HANDLE_VALUE) {
cap = rts_lock();
-#if defined(mingw32_HOST_OS) && defined(i386_HOST_ARCH) && defined(__PIC__)
+#if defined(COMPILING_WINDOWS_DLL)
rts_evalIO(&cap,_imp__base_GHCziConcziIO_ensureIOManagerIsRunning_closure,NULL);
#else
rts_evalIO(&cap,&base_GHCziConcziIO_ensureIOManagerIsRunning_closure,NULL);
|