Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC
Commits:
b8cfa8f7 by Cheng Shao at 2025-09-19T18:29:01-04:00
rts: remove obsolete COMPILING_WINDOWS_DLL logic
This patch removes obsolete COMPILING_WINDOWS_DLL logic throughout the
rts. They were once used for compiling to win32 DLLs, but we haven't
been able to compile Haskell units to win32 DLLs for many years now,
due to PE format's restriction of no more than 65536 exported symbols
in a single DLL.
- - - - -
8 changed files:
- − rts/RtsDllMain.c
- − rts/RtsDllMain.h
- rts/RtsSymbols.c
- rts/StgMiscClosures.cmm
- rts/include/RtsAPI.h
- rts/include/stg/DLL.h
- rts/rts.cabal
- rts/sm/Evac.c
Changes:
=====================================
rts/RtsDllMain.c deleted
=====================================
@@ -1,43 +0,0 @@
-/* -----------------------------------------------------------------------------
- *
- * (c) The GHC Team 1999-2000
- *
- * Entry point for RTS-in-a-DLL
- *
- * ---------------------------------------------------------------------------*/
-
-#include "rts/PosixSource.h"
-#include "Rts.h"
-#include "RtsAPI.h"
-#include "RtsDllMain.h"
-
-#if defined(HAVE_WINDOWS_H)
-#include
-#endif
-
-/* I'd be mildly surprised if this wasn't defined, but still. */
-#if defined(COMPILING_WINDOWS_DLL)
-BOOL
-WINAPI
-DllMain ( HINSTANCE hInstance STG_UNUSED
- , DWORD reason
- , LPVOID reserved STG_UNUSED
- )
-{
- /*
- * Note: the DllMain() doesn't call startupHaskell() for you,
- * that is the task of users of the RTS. The reason is
- * that *you* want to be able to control the arguments
- * you pass to the RTS.
- */
- switch (reason) {
-
- // shutdownHaskelAndExit() is already being called,
- // so I don't think we need this. BL 2009/11/17
-
- //case DLL_PROCESS_DETACH: shutdownHaskell();
- }
- return true;
-}
-
-#endif
=====================================
rts/RtsDllMain.h deleted
=====================================
@@ -1,15 +0,0 @@
-#include "Rts.h"
-
-#if defined(HAVE_WINDOWS_H)
-#include
-#endif
-
-/* I'd be mildly surprised if this wasn't defined, but still. */
-#if defined(COMPILING_WINDOWS_DLL)
-BOOL
-WINAPI
-DllMain ( HINSTANCE hInstance
- , DWORD reason
- , LPVOID reserved
- );
-#endif
=====================================
rts/RtsSymbols.c
=====================================
@@ -435,17 +435,9 @@ extern char **environ;
// On most platforms, the garbage collector rewrites references
// to small integer and char objects to a set of common, shared ones.
-//
-// 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(COMPILING_WINDOWS_DLL)
-#define RTS_INTCHAR_SYMBOLS
-#else
#define RTS_INTCHAR_SYMBOLS \
SymI_HasProto(stg_CHARLIKE_closure) \
SymI_HasProto(stg_INTLIKE_closure)
-#endif
#if defined(PROFILING)
#define RTS_PROF_SYMBOLS \
@@ -1027,20 +1019,9 @@ extern char **environ;
/* entirely bogus claims about types of these symbols */
#define SymI_NeedsProto(vvv) extern void vvv(void);
#define SymI_NeedsDataProto(vvv) extern StgWord vvv[];
-#if defined(COMPILING_WINDOWS_DLL)
-#define SymE_HasProto(vvv) SymE_HasProto(vvv);
-# if defined(x86_64_HOST_ARCH)
-# define SymE_NeedsProto(vvv) extern void __imp_ ## vvv (void);
-# define SymE_NeedsDataProto(vvv) SymE_NeedsProto(vvv)
-# else
-# define SymE_NeedsProto(vvv) extern void _imp__ ## vvv (void);
-# define SymE_NeedsDataProto(vvv) SymE_NeedsProto(vvv)
-# endif
-#else
#define SymE_NeedsProto(vvv) SymI_NeedsProto(vvv);
#define SymE_NeedsDataProto(vvv) SymI_NeedsDataProto(vvv);
#define SymE_HasProto(vvv) SymI_HasProto(vvv);
-#endif
#define SymI_HasProto(vvv) /**/
#define SymI_HasDataProto(vvv) /**/
#define SymI_HasProto_redirect(vvv,xxx,strength,ty) /**/
=====================================
rts/StgMiscClosures.cmm
=====================================
@@ -1040,28 +1040,12 @@ CLOSURE(stg_ASYNCIO_LIVE0_closure,stg_ASYNCIO_LIVE0);
replace them with references to the static objects.
------------------------------------------------------------------------- */
-#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
- * when we've got the real addresses to the C# and I# closures.
- *
- * -- this is currently broken BL 2009/11/14.
- * we don't rewrite to static closures at all with Windows DLLs.
- */
-// #warning Is this correct? _imp is a pointer!
-#define Char_hash_con_info _imp__ghczminternal_GHCziInternalziTypes_Czh_con_info
-#define Int_hash_con_info _imp__ghczminternal_GHCziInternalziTypes_Izh_con_info
-#else
#define Char_hash_con_info ghczminternal_GHCziInternalziTypes_Czh_con_info
#define Int_hash_con_info ghczminternal_GHCziInternalziTypes_Izh_con_info
-#endif
-
#define CHARLIKE_HDR(n) CLOSURE(Char_hash_con_info, n)
#define INTLIKE_HDR(n) CLOSURE(Int_hash_con_info, n)
-#if !(defined(COMPILING_WINDOWS_DLL))
section "data" {
stg_CHARLIKE_closure:
CHARLIKE_HDR(0)
@@ -1598,5 +1582,3 @@ section "data" {
INTLIKE_HDR(255) /* MAX_INTLIKE == 255
See #16961 for why 255 */
}
-
-#endif
=====================================
rts/include/RtsAPI.h
=====================================
@@ -581,19 +581,11 @@ void rts_done (void);
These are used by foreign export and foreign import "wrapper" stubs.
----------------------------------------------------------------------- */
-// When producing Windows DLLs the we need to know which symbols are in the
-// local package/DLL vs external ones.
-//
// Note that RtsAPI.h is also included by foreign export stubs in
// the base package itself.
//
-#if defined(COMPILING_WINDOWS_DLL) && !defined(COMPILING_GHC_INTERNAL_PACKAGE)
-__declspec(dllimport) extern StgClosure ghczminternal_GHCziInternalziTopHandler_runIO_closure;
-__declspec(dllimport) extern StgClosure ghczminternal_GHCziInternalziTopHandler_runNonIO_closure;
-#else
extern StgClosure ghczminternal_GHCziInternalziTopHandler_runIO_closure;
extern StgClosure ghczminternal_GHCziInternalziTopHandler_runNonIO_closure;
-#endif
#define runIO_closure DLL_IMPORT_DATA_REF(ghczminternal_GHCziInternalziTopHandler_runIO_closure)
#define runNonIO_closure DLL_IMPORT_DATA_REF(ghczminternal_GHCziInternalziTopHandler_runNonIO_closure)
=====================================
rts/include/stg/DLL.h
=====================================
@@ -13,29 +13,9 @@
#pragma once
-#if defined(COMPILING_WINDOWS_DLL)
-# if defined(x86_64_HOST_ARCH)
-# define DLL_IMPORT_DATA_REF(x) (__imp_##x)
-# define DLL_IMPORT_DATA_VARNAME(x) *__imp_##x
-# else
-# define DLL_IMPORT_DATA_REF(x) (_imp__##x)
-# define DLL_IMPORT_DATA_VARNAME(x) *_imp__##x
-# endif
-# if __GNUC__ && !defined(__declspec)
-# define DLLIMPORT
-# else
-# define DLLIMPORT __declspec(dllimport)
-# if defined(x86_64_HOST_ARCH)
-# define DLLIMPORT_DATA(x) __imp_##x
-# else
-# define DLLIMPORT_DATA(x) _imp__##x
-# endif
-# endif
-#else
# define DLL_IMPORT_DATA_REF(x) (&(x))
# define DLL_IMPORT_DATA_VARNAME(x) x
# define DLLIMPORT
-#endif
/* The view of the rts/include/ header files differ ever so
slightly depending on whether the RTS is being compiled
@@ -47,26 +27,9 @@
using Win32 DLLs. ]
*/
#if defined(COMPILING_RTS)
-#define DLL_IMPORT DLLIMPORT
#define DLL_IMPORT_RTS
#define DLL_IMPORT_DATA_VAR(x) x
#else
-#define DLL_IMPORT
#define DLL_IMPORT_RTS DLLIMPORT
-# if defined(COMPILING_WINDOWS_DLL)
-# if defined(x86_64_HOST_ARCH)
-# define DLL_IMPORT_DATA_VAR(x) __imp_##x
-# else
-# define DLL_IMPORT_DATA_VAR(x) _imp__##x
-# endif
-# else
-# define DLL_IMPORT_DATA_VAR(x) x
-# endif
-#endif
-
-
-#if defined(COMPILING_STDLIB)
-#define DLL_IMPORT_STDLIB
-#else
-#define DLL_IMPORT_STDLIB DLLIMPORT
+#define DLL_IMPORT_DATA_VAR(x) x
#endif
=====================================
rts/rts.cabal
=====================================
@@ -443,7 +443,6 @@ library
RetainerProfile.c
RetainerSet.c
RtsAPI.c
- RtsDllMain.c
RtsFlags.c
RtsMain.c
RtsMessages.c
=====================================
rts/sm/Evac.c
=====================================
@@ -857,9 +857,6 @@ loop:
//
case CONSTR_0_1:
{
-#if defined(COMPILING_WINDOWS_DLL)
- copy_tag_nolock(p,info,q,sizeofW(StgHeader)+1,gen_no,tag);
-#else
StgWord w = (StgWord)q->payload[0];
if (info == Czh_con_info &&
// unsigned, so always true: (StgChar)w >= MIN_CHARLIKE &&
@@ -879,7 +876,6 @@ loop:
else {
copy_tag_nolock(p,info,q,sizeofW(StgHeader)+1,gen_no,tag);
}
-#endif
return;
}
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/b8cfa8f741729ef123569fb321c4b2ab...
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/b8cfa8f741729ef123569fb321c4b2ab...
You're receiving this email because of your account on gitlab.haskell.org.