Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
GHC
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
0
Merge Requests
0
Requirements
Requirements
List
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Package Registry
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issue
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
jberryman
GHC
Commits
006a18ea
Commit
006a18ea
authored
Aug 08, 2007
by
Clemens Fruhwirth
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Build RTS as dynamic library
parent
90ef8ab2
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
169 additions
and
235 deletions
+169
-235
configure.ac
configure.ac
+7
-0
includes/StgDLL.h
includes/StgDLL.h
+13
-13
mk/config.mk.in
mk/config.mk.in
+18
-0
mk/package.mk
mk/package.mk
+4
-63
mk/target.mk
mk/target.mk
+38
-61
rts/Linker.c
rts/Linker.c
+2
-6
rts/Makefile
rts/Makefile
+35
-38
rts/Prelude.h
rts/Prelude.h
+47
-47
rts/RetainerProfile.c
rts/RetainerProfile.c
+1
-2
rts/RtsDllMain.c
rts/RtsDllMain.c
+2
-3
rts/StgMiscClosures.cmm
rts/StgMiscClosures.cmm
+1
-1
rts/sm/Scav.c
rts/sm/Scav.c
+1
-1
No files found.
configure.ac
View file @
006a18ea
...
...
@@ -100,6 +100,7 @@ if test x"$TargetPlatform" != x"$HostPlatform" ; then
fi
exeext=''
soext='.so'
#
# The following will be more difficult when we *are* cross-compiling.
# Suitable names to slam in *_CPP are in platform.h.in.
...
...
@@ -295,6 +296,7 @@ i[[3456]]86-*-cygwin*)
HostVendor_CPP='unknown'
HostOS_CPP='cygwin32'
exeext='.exe'
soext='.dll'
;;
i[[3456]]86-*-mingw32*)
HostPlatform=i386-unknown-mingw32 # hack again
...
...
@@ -305,6 +307,7 @@ i[[3456]]86-*-mingw32*)
HostVendor_CPP='unknown'
HostOS_CPP='mingw32'
exeext='.exe'
soext='.dll'
;;
i[[3456]]86-apple-darwin*)
HostPlatform=i386-apple-darwin
...
...
@@ -314,6 +317,7 @@ i[[3456]]86-apple-darwin*)
HostArch_CPP='i386'
HostVendor_CPP='apple'
HostOS_CPP='darwin'
soext='.dylib'
;;
i[[3456]]86-*-gnu*)
HostPlatform=i386-unknown-gnu
...
...
@@ -350,6 +354,7 @@ x86_64-apple-darwin*)
HostArch_CPP='x86_64'
HostVendor_CPP='apple'
HostOS_CPP='darwin'
soext='.dylib'
;;
m68k-*-linux*)
HostPlatform=m68k-unknown-linux # hack again
...
...
@@ -476,6 +481,7 @@ powerpc-apple-darwin*)
HostArch_CPP='powerpc'
HostVendor_CPP='apple'
HostOS_CPP='darwin'
soext='.dylib'
;;
powerpc-unknown-linux*)
HostPlatform=powerpc-unknown-linux
...
...
@@ -608,6 +614,7 @@ AC_SUBST(BuildVendor_CPP)
AC_SUBST(TargetVendor_CPP)
AC_SUBST(exeext)
AC_SUBST(soext)
dnl --------------------------------------------------------------
dnl * Project specific configuration options
...
...
includes/StgDLL.h
View file @
006a18ea
#ifndef __STGDLL_H__
#define __STGDLL_H__ 1
#if defined(HAVE_WIN32_DLL_SUPPORT) && !defined(DONT_WANT_WIN32_DLL_SUPPORT)
#define ENABLE_WIN32_DLL_SUPPORT
#endif
#ifdef ENABLE_WIN32_DLL_SUPPORT
# if __GNUC__ && !defined(__declspec)
# define DLLIMPORT
# else
# define DLLIMPORT __declspec(dllimport)
# define DLLIMPORT_DATA(x) _imp__##x
# endif
#if defined(__PIC__) && defined(mingw32_TARGET_OS)
# define DLL_IMPORT_DATA_REF(x) (_imp__##x)
# define DLL_IMPORT_DATA_VARNAME(x) *_imp__##x
# if __GNUC__ && !defined(__declspec)
# define DLLIMPORT
# else
# define DLLIMPORT __declspec(dllimport)
# define DLLIMPORT_DATA(x) _imp__##x
# endif
#else
# define DLLIMPORT
# define DLL_IMPORT_DATA_REF(x) (&(x))
# define DLL_IMPORT_DATA_VARNAME(x) x
# define DLLIMPORT
#endif
/* The view of the ghc/includes/ header files differ ever so
...
...
@@ -32,7 +32,7 @@
#else
#define DLL_IMPORT
#define DLL_IMPORT_RTS DLLIMPORT
# if
def ENABLE_WIN32_DLL_SUPPORT
# if
defined(__PIC__) && defined(mingw32_TARGET_OS)
# define DLL_IMPORT_DATA_VAR(x) _imp__##x
# else
# define DLL_IMPORT_DATA_VAR(x) x
...
...
mk/config.mk.in
View file @
006a18ea
...
...
@@ -163,6 +163,7 @@ LeadingUnderscore=@LeadingUnderscore@
# Pin a suffix on executables? If so, what (Windows only).
exeext
=
@exeext@
soext
=
@soext@
# Windows=YES if on a Windows platform
ifneq
"$(findstring $(HostOS_CPP), mingw32 cygwin32)" ""
...
...
@@ -1166,6 +1167,23 @@ WAY_thr_debug_HC_OPTS=-optc-DTHREADED_RTS -optc-DDEBUG
WAY_thr_debug_p_NAME
=
threaded
WAY_thr_debug_p_HC_OPTS
=
-optc-DTHREADED_RTS
-optc-DDEBUG
-prof
# Way 'dyn': build dynamic shared libraries
WAY_dyn_NAME
=
dyn
WAY_dyn_HC_OPTS
=
-fPIC
-dynamic
WAY_dyn_LIB_TARGET
=
libHSrts-gcc661.so
# Way 'thr_dyn':
WAY_thr_dyn_NAME
=
thr_dyn
WAY_thr_dyn_HC_OPTS
=
-fPIC
-dynamic
-optc-DTHREADED_RTS
# Way 'thr_debug_dyn':
WAY_thr_debug_dyn_NAME
=
thr_dyn
WAY_thr_debug_dyn_HC_OPTS
=
-fPIC
-dynamic
-optc-DTHREADED_RTS
-optc-DDEBUG
# Way 'debug_dyn':
WAY_debug_dyn_NAME
=
thr_dyn
WAY_debug_dyn_HC_OPTS
=
-fPIC
-dynamic
-optc-DDEBUG
#
# Add user-way configurations here:
#
...
...
mk/package.mk
View file @
006a18ea
...
...
@@ -138,8 +138,12 @@ SRC_HC_OPTS += -fgenerics
endif
ifndef
LIBRARY
ifeq
"$(_way:%_dyn=YES)" "YES"
LIBRARY
=
libHS
$(PACKAGE)$(_way:%_dyn=%)
-ghc
$(ProjectVersion)$(soext)
else
LIBRARY
=
libHS
$(PACKAGE)$(_way)
.a
endif
endif
ifeq
"$(WAYS)" ""
WAYS
=
$(GhcLibWays)
...
...
@@ -246,69 +250,6 @@ $(GHCI_LIBRARY) : $(LIBOBJS)
endif
# DONT_WANT_STD_GHCI_LIB_RULE
endif
# GhcWithInterpreter
endif
# way
ifeq
"$(GhcBuildDylibs)" "YES"
# Build dynamic libraries.
# Currently, this is a hack. Anyone, PLEASE clean it up.
# For now, we pretend that there are two operating systems in the world;
# Darwin, and Everything Else. Furthermore, we pretend that Everything Else
# behaves like Linux.
ifeq
"$(darwin_TARGET_OS)" "1"
# Darwin: Shared libraries end in .dylib
DYLD_LIBRARY
=
$(
patsubst
%.a,%_dyn.dylib,
$(LIBRARY)
)
# About the options used for Darwin:
# -dynamiclib
# Apple's way of saying -shared
# -undefined dynamic_lookup:
# Without these options, we'd have to specify the correct dependencies
# for each of the dylibs. Note that we could (and should) do without this
# for all libraries except the RTS; all we need to do is to pass the
# correct HSfoo_dyn.dylib files to the link command.
# This feature requires Mac OS X 10.3 or later; there is a similar feature,
# -flat_namespace -undefined suppress, which works on earlier versions,
# but it has other disadvantages.
# -single_module
# Build the dynamic library as a single "module", i.e. no dynamic binding
# nonsense when referring to symbols from within the library. The NCG
# assumes that this option is specified (on i386, at least).
# -Wl,-macosx_version_min -Wl,10.3
# Tell the linker its safe to assume that the library will run on 10.3 or
# later, so that it will not complain about the use of the option
# -undefined dynamic_lookup above.
# -install_name
# Causes the dynamic linker to ignore the DYLD_LIBRARY_PATH when loading
# this lib and instead look for it at its absolute path.
# When installing the .dylibs (see target.mk), we'll change that path to
# point to the place they are installed. Therefore, we won't have to set
# up DYLD_LIBRARY_PATH specifically for ghc.
$(DYLD_LIBRARY)
:
$(LIBOBJS) $(STUBOBJS)
$(CC)
-dynamiclib
-o
$@
$(STUBOBJS)
$(LIBOBJS)
\
-undefined
dynamic_lookup
-single_module
\
-Wl
,-macosx_version_min
-Wl
,10.3
\
-install_name
`
pwd
`
/
$@
else
DYLD_LIBRARY
=
$(
patsubst
%.a,%_dyn.so,
$(LIBRARY)
)
$(DYLD_LIBRARY)
:
$(LIBOBJS) $(STUBOBJS)
$(CC)
-shared
-o
$@
$(STUBOBJS)
$(LIBOBJS)
endif
ifneq
"$(NO_INSTALL_LIBRARY)" "YES"
INSTALL_LIBS
+=
$(DYLD_LIBRARY)
endif
CLEAN_FILES
+=
$(DYLD_LIBRARY)
all
::
$(DYLD_LIBRARY)
endif
# $(GhcBuildDylibs) == "YES"
endif
# $(LIBRARY) /= ""
# -----------------------------------------------------------------------------
...
...
mk/target.mk
View file @
006a18ea
...
...
@@ -265,13 +265,13 @@ ifneq "$(LIBRARY)" ""
all
::
$(LIBRARY)
ifneq
"$(way)" "i"
define
BUILD_LIB
define
BUILD_
STATIC_
LIB
$(RM)
$@
$(AR)
$(AR_OPTS)
$@
$(STUBOBJS)
$(LIBOBJS)
$(RANLIB)
$@
endef
else
define
BUILD_LIB
define
BUILD_
STATIC_
LIB
$(RM)
$@
al -out
:
$@ $(STUBOBJS) $(LIBOBJS)
endef
...
...
@@ -298,13 +298,13 @@ SRC_HC_OPTS += -split-objs
# rename it at the end. This avoids the problem that ar may sometimes
# fail, leaving a partially built archive behind.
ifeq
"$(ArSupportsInput)" ""
define
BUILD_LIB
define
BUILD_
STATIC_
LIB
$(RM)
$@
$@.tmp
(echo
$(STUBOBJS)
$(C_OBJS)
$(GC_C_OBJS);
$(FIND)
$(patsubst
%.$(way_)o,%_split,$(HS_OBJS))
-name
'*.$(way_)o'
-print)
|
xargs
$(AR)
$@
$(RANLIB)
$@
endef
else
define
BUILD_LIB
define
BUILD_
STATIC_
LIB
$(RM)
$@
$@.tmp
echo
$(STUBOBJS)
>
$@.list
echo
$(C_OBJS)
>>
$@.list
...
...
@@ -351,70 +351,35 @@ endif # StripLibraries
# Note: $(STUBOBJS) isn't depended on here, but included when building the lib.
# (i.e., the assumption is that $(STUBOBJS) are created as a side-effect
# of building $(LIBOBJS)).
$(LIBRARY)
:
$(LIBOBJS)
$(BUILD_LIB)
endif
# LIBRARY = ""
ifeq
"$(LIBRARY:%.so=YES)" "YES"
# ELF styled DSO
$(LIBRARY)
:
$(LIBOBJS) $(LIB_DEPS)
$(RM)
$@
$(HC)
-shared
-dynamic
-o
$@
$(STUBOBJS)
$(LIBOBJS)
$(LIB_LD_OPTS)
else
ifeq
"$(LIBRARY:%.dylib=YES)" "YES"
$(LIBRARY)
:
$(LIBOBJS) $(LIB_DEPS)
$(HC)
-shared
-dynamic
-o
$@
$(STUBOBJS)
$(LIBOBJS)
$(LIB_LD_OPTS)
else
ifeq
"$(LIBRARY:%.dll=YES)" "YES"
#----------------------------------------
# Building Win32 DLLs
#
$(LIBRARY)
:
$(LIBOBJS) $(LIBRARY).o $(LIB_DEPS)
$(HC)
-shared
-dynamic
-o
$@
$(STUBOBJS)
$(LIBOBJS)
$(LIBRARY)
.o
$(LIB_LD_OPTS)
ifeq
"$(DLLized)" "YES"
SRC_CC_OPTS
+=
-DDLLized
ifneq
"$(PACKAGE)" ""
SRC_BLD_DLL_OPTS
+=
--export-all
--output-def
=
HS
$(PACKAGE)$(_cbits)$(_way)
.def DllVersionInfo.
$(way_)
o
ifneq
"$(PACKAGE) $(IS_CBITS_LIB)" "std YES"
ifneq
"$(PACKAGE)" "rts"
SRC_BLD_DLL_OPTS
+=
-lHSstd_cbits_imp
-L
$(GHC_LIB_DIR)
/std/cbits
SRC_BLD_DLL_OPTS
+=
-lHSrts_
$(way_)
imp
-L
$(GHC_RTS_DIR)
ifneq
"$(PACKAGE)" "std"
ifeq
"$(IS_CBITS_LIB)" ""
SRC_BLD_DLL_OPTS
+=
-lHSstd_
$(way_)
imp
-L
$(GHC_LIB_DIR)
/std
endif
endif
endif
endif
SRC_BLD_DLL_OPTS
+=
-lgmp
-L
.
-L
$(GHC_RTS_DIR)
/gmp
ifeq
"$(IS_CBITS_LIB)" ""
SRC_BLD_DLL_OPTS
+=
$(
patsubst
%,-lHS%_
$(way_)
imp,
$(PACKAGE_DEPS)
)
SRC_BLD_DLL_OPTS
+=
$(
patsubst
%,-L../%,
$(PACKAGE_DEPS)
)
endif
ifneq
"$(HAS_CBITS)" ""
SRC_BLD_DLL_OPTS
+=
-lHS
$(PACKAGE)
_cbits_imp
-Lcbits
endif
SRC_BLD_DLL_OPTS
+=
-lwsock32
-lwinmm
endif
# PACKAGE != ""
DLLTOOL
=
dlltool
SplitObjs
=
NO
$(LIBRARY).def
:
$(LIBOBJS)
$(DLLTOOL)
--output-def
$@
--export-all
$(LIBOBJS)
ifneq
"$(LIBRARY)" ""
all
::
DllVersionInfo.$(way_)o
$(LIBRARY).o
:
$(DLLTOOL)
--output-exp
$(LIBRARY)
.o
$(LIBOBJS)
ifeq
"$(DLL_NAME)" ""
DLL_NAME
=
$(
patsubst
%.a,%.dll,
$(
subst
lib,,
$(LIBRARY)
))
endif
ifneq
"$(DLL_NAME)" ""
DLL_NAME
:=
$(DLL_PEN)
/
$(DLL_NAME)
endif
all
::
$(DLL_NAME)
ifeq
"$(DLL_IMPLIB_NAME)" ""
DLL_IMPLIB_NAME
=
$(
patsubst
%.a,%_imp.a,
$(LIBRARY)
)
endif
$(DLL_NAME)
::
$(LIBRARY)
$(BLD_DLL)
--output-lib
$(DLL_IMPLIB_NAME)
-o
$(DLL_NAME)
$(LIBRARY)
$(BLD_DLL_OPTS)
endif
# LIBRARY != ""
endif
# DLLized
# Generates library.dll.a; by MinGW conventions, this is the dll's import library
$(LIBRARY).a
:
$(LIBOBJS) $(LIBRARY).def
$(DLLTOOL)
--def
$(LIBRARY)
.def
--output-lib
$@
#
# Version information is baked into a DLL by having the DLL include DllVersionInfo.o.
...
...
@@ -483,6 +448,14 @@ DllVersionInfo.$(way_)rc ExeVersionInfo.$(way_)rc:
echo
" VALUE
\"
Translation
\"
, 0x0409, 1200"
>>
$@
echo
" END"
>>
$@
echo
"END"
>>
$@
else
# Regular static library
$(LIBRARY)
:
$(LIBOBJS)
$(BUILD_STATIC_LIB)
endif
# %.dll
endif
# %.dylib
endif
# %.so
endif
# LIBRARY = ""
include
$(TOP)/mk/install.mk
...
...
@@ -651,7 +624,8 @@ ifeq "$(way)" ""
FPTOOLS_SUFFIXES
:=
o hi hc
WAY_TARGETS
=
$(
foreach
way,
$(WAYS)
,
$(
foreach
suffix,
$(FPTOOLS_SUFFIXES)
, %.
$(way)
_
$(suffix)
))
LIB_WAY_TARGETS
=
$(
foreach
way,
$(WAYS)
,%_
$(way)
.a %_
$(way)
)
LIB_WAY_TARGETS
=
$(
foreach
way,
$(
filter-out
%dyn,
$(WAYS)
)
, %_
$(way)
.a
)
LIB_WAY_TARGETS_DYN
=
$(
foreach
way,
$(
filter
%dyn,
$(WAYS)
)
, %
$(
subst
dyn,-ghc
$(ProjectVersion)
,
$(
subst
_dyn,dyn,
$(way)
))
$(soext)
)
# $@ will be something like Foo.p_o
# $(suffix $@) returns .p_o
...
...
@@ -669,6 +643,9 @@ $(WAY_TARGETS) :
$(LIB_WAY_TARGETS)
:
$(MAKE)
$(MFLAGS)
$@
way
=
$(
subst
.,,
$(
suffix
$(
subst
_,.,
$(
basename
$@
))))
$(LIB_WAY_TARGETS_DYN)
:
$(MAKE)
$(MFLAGS)
$@
way
=
$(
patsubst
_dyn,dyn,
$(
subst
.,,
$(
suffix
$(
subst
_,.,
$(
basename
$(
subst
-ghc
$(ProjectVersion)
,,
$@
)))))
_dyn
)
endif
# if way
# -------------------------------------------------------------------------
...
...
rts/Linker.c
View file @
006a18ea
...
...
@@ -766,7 +766,7 @@ typedef struct _RtsSymbolVal {
/* entirely bogus claims about types of these symbols */
#define Sym(vvv) extern void vvv(void);
#if
def ENABLE_WIN32_DLL_SUPPORT
#if
defined(__PIC__) && defined(mingw32_TARGET_OS)
#define SymExtern(vvv) extern void _imp__ ## vvv (void);
#else
#define SymExtern(vvv) SymX(vvv)
...
...
@@ -795,12 +795,8 @@ RTS_LIBGCC_SYMBOLS
#define Sym(vvv) { MAYBE_LEADING_UNDERSCORE_STR(#vvv), \
(void*)(&(vvv)) },
#define SymX(vvv) Sym(vvv)
#ifdef ENABLE_WIN32_DLL_SUPPORT
#define SymExtern(vvv) { MAYBE_LEADING_UNDERSCORE_STR(#vvv), \
(void*)(_imp__ ## vvv) },
#else
#define SymExtern(vvv) Sym(vvv)
#endif
(void*)DLL_IMPORT_DATA_REF(vvv) },
// SymX_redirect allows us to redirect references to one symbol to
// another symbol. See newCAF/newDynCAF for an example.
...
...
rts/Makefile
View file @
006a18ea
...
...
@@ -49,10 +49,20 @@ else
ALL_DIRS
+=
posix
endif
ifneq
"$(
DLLized)" "YES
"
EXCLUDED_SRCS
+=
RtsDllMain.c
ifneq
"$(
findstring dyn, $(way))" "
"
DYNAMIC_RTS
=
YES
else
DYNAMIC_RTS
=
NO
endif
ifeq
"$(DYNAMIC_RTS) $(HOSTPLATFORM)" "YES i386-unknown-mingw32"
EXCLUDED_SRCS
+=
Main.c
# It's not included in the DLL, but we need to compile it up separately.
all
::
Main.$(way_)o
INSTALL_LIBS
+=
Main.
$(way_)
o
else
EXCLUDED_SRCS
+=
RtsDllMain.c
endif
# This file ends up being empty unless we're building for a powerpc
...
...
@@ -114,17 +124,29 @@ SRC_CC_OPTS += $(WARNING_OPTS)
SRC_CC_OPTS
+=
$(STANDARD_OPTS)
SRC_CC_OPTS
+=
$(GhcRtsCcOpts)
SRC_HC_OPTS
+=
$(GhcRtsHcOpts)
SRC_HC_OPTS
+=
$(GhcRtsHcOpts)
-package-name
rts
ifneq
"$(GhcWithSMP)" "YES"
SRC_CC_OPTS
+=
-DNOSMP
SRC_HC_OPTS
+=
-optc-DNOSMP
endif
ifneq
"$(D
LLized
)" "YES"
ifneq
"$(D
YNAMIC_RTS
)" "YES"
SRC_HC_OPTS
+=
-static
else
LIB_LD_OPTS
+=
-ignore-package
base
-ignore-package
rts
ifeq
"$(DYNAMIC_RTS) $(HOSTPLATFORM)" "YES i386-unknown-mingw32"
BASE_VERSION
=
$(
strip
$(
shell
grep
version:
$(TOP)
/libraries/base/base.cabal |
cut
-f2
-d
:
))
BASE_NAME
=
HSbase-
$(BASE_VERSION)
-ghc
$(ProjectVersion)$(soext)
BASE_DIST_LIB
=
$(TOP)
/libraries/base/dist/build
BASE_IMPORT_LIBRARY
=
$(BASE_DIST_LIB)
/lib
$(BASE_NAME)
.a
LIB_DEPS
=
$(BASE_IMPORT_LIBRARY)
LIB_LD_OPTS
+=
-L
$(BASE_DIST_LIB)
-l
$(BASE_NAME)
# We extract a good bit of information out of the rts package.conf by going via ghc-pkg
LIB_LD_OPTS
+=
$(
foreach
lib,
$(
shell
$(GHC_PKG_INPLACE)
field rts extra-libraries |
sed
-e
s/extra-libraries://
)
,
"-l
$(lib)
"
)
LIB_LD_OPTS
+=
$(
foreach
libdir,
$(
shell
$(GHC_PKG_INPLACE)
field rts library-dirs |
sed
-e
s/library-dirs://
)
,
"-L
$(libdir)
"
)
endif
endif
# SRC_HC_OPTS += -fPIC
RtsMessages_CC_OPTS
+=
-DProjectVersion
=
\"
$(ProjectVersion)
\"
RtsFlags_CC_OPTS
+=
-DProjectVersion
=
\"
$(ProjectVersion)
\"
...
...
@@ -227,31 +249,6 @@ CLEAN_FILES += $(AUTO_APPLY_CMM)
endif
# -----------------------------------------------------------------------------
#
# Building DLLs is only supported on mingw32 at the moment.
#
ifeq
"$(DLLized)" "YES"
SRC_BLD_DLL_OPTS
+=
-lHS_imp_stub
-lgmp_imp
# It's not included in the DLL, but we need to compile it up separately.
all
::
Main.dll_o
# Need an import library containing the symbols the RTS uses from the Prelude.
# So, to avoid bootstrapping trouble, we build one containing just the syms
# we need. Weirdly named to avoid clashing later on when compiling the contents
# of ghc/lib/..
#
# Note: if you do change the name of the Prelude DLL, the "--dllname <nm>.dll"
# below will need to be updated as well.
$(DLL_PEN)/HSrts$(_way).dll
::
libHS_imp_stub.a
libHS_imp_stub.a
:
dlltool
--output-lib
libHS_imp_stub.a
--def
HSprel.def
--dllname
HSstd.dll
endif
# -----------------------------------------------------------------------------
# Compile GMP only if we don't have it already
#
...
...
@@ -336,9 +333,6 @@ sm/Compact_HC_OPTS += -optc-finline-limit=2500
# upd_evacee() assigments get moved before the object copy.
SRC_CC_OPTS
+=
-fno-strict-aliasing
# Cmm must be compiled via-C for now, because the NCG can't handle loops
SRC_HC_OPTS
+=
-fvia-C
# We *want* type-checking of hand-written cmm.
SRC_HC_OPTS
+=
-dcmm-lint
...
...
@@ -362,17 +356,20 @@ endif
#
# Just libHSrts is installed uniformly across ways
#
ifeq
"$(DLLized)" "YES"
INSTALL_PROGS
+=
gmp/gmp.dll
INSTALL_LIBS
+=
gmp/libgmp_imp.a Main.dll_o
include
$(TOP)/mk/target.mk
ifeq
"$(DYNAMIC_RTS) $(HOSTPLATFORM)" "YES i386-unknown-mingw32"
$(BASE_IMPORT_LIBRARY)
:
$(LIBRARY).a
$(MAKE)
-C
../libraries/ make.library.base
# just for the timestamps
touch
$(BASE_IMPORT_LIBRARY)
endif
#-----------------------------------------------------------------------------
#
# binary-dist
include
$(TOP)/mk/target.mk
binary-dist
:
$(INSTALL_DIR)
$(BIN_DIST_DIR)
/rts
$(INSTALL_DIR)
$(BIN_DIST_DIR)
/rts/gmp
...
...
rts/Prelude.h
View file @
006a18ea
...
...
@@ -16,8 +16,8 @@
#define PRELUDE_INFO(i) extern W_(i)[]
#define PRELUDE_CLOSURE(i) extern W_(i)[]
#else
#define PRELUDE_INFO(i) extern
DLL_IMPORT const StgInfoTable i
#define PRELUDE_CLOSURE(i) extern
DLL_IMPORT StgClosure i
#define PRELUDE_INFO(i) extern
const StgInfoTable DLL_IMPORT_DATA_VARNAME(i)
#define PRELUDE_CLOSURE(i) extern
StgClosure DLL_IMPORT_DATA_VARNAME(i)
#endif
/* Define canonical names so we can abstract away from the actual
...
...
@@ -79,53 +79,53 @@ PRELUDE_INFO(base_GHCziWord_W64zh_con_info);
PRELUDE_INFO
(
base_GHCziStable_StablePtr_static_info
);
PRELUDE_INFO
(
base_GHCziStable_StablePtr_con_info
);
#define True_closure
(&
base_GHCziBase_True_closure)
#define False_closure
(&
base_GHCziBase_False_closure)
#define unpackCString_closure
(&
base_GHCziPack_unpackCString_closure)
#define runFinalizerBatch_closure
(&
base_GHCziWeak_runFinalizzerBatch_closure)
#define True_closure
DLL_IMPORT_DATA_REF(
base_GHCziBase_True_closure)
#define False_closure
DLL_IMPORT_DATA_REF(
base_GHCziBase_False_closure)
#define unpackCString_closure
DLL_IMPORT_DATA_REF(
base_GHCziPack_unpackCString_closure)
#define runFinalizerBatch_closure
DLL_IMPORT_DATA_REF(
base_GHCziWeak_runFinalizzerBatch_closure)
#define mainIO_closure (&ZCMain_main_closure)
#define stackOverflow_closure
(&
base_GHCziIOBase_stackOverflow_closure)
#define heapOverflow_closure
(&
base_GHCziIOBase_heapOverflow_closure)
#define BlockedOnDeadMVar_closure
(&
base_GHCziIOBase_BlockedOnDeadMVar_closure)
#define BlockedIndefinitely_closure
(&
base_GHCziIOBase_BlockedIndefinitely_closure)
#define NonTermination_closure
(&
base_GHCziIOBase_NonTermination_closure)
#define NestedAtomically_closure
(&
base_GHCziIOBase_NestedAtomically_closure)
#define stackOverflow_closure
DLL_IMPORT_DATA_REF(
base_GHCziIOBase_stackOverflow_closure)
#define heapOverflow_closure
DLL_IMPORT_DATA_REF(
base_GHCziIOBase_heapOverflow_closure)
#define BlockedOnDeadMVar_closure
DLL_IMPORT_DATA_REF(
base_GHCziIOBase_BlockedOnDeadMVar_closure)
#define BlockedIndefinitely_closure
DLL_IMPORT_DATA_REF(
base_GHCziIOBase_BlockedIndefinitely_closure)
#define NonTermination_closure
DLL_IMPORT_DATA_REF(
base_GHCziIOBase_NonTermination_closure)
#define NestedAtomically_closure
DLL_IMPORT_DATA_REF(
base_GHCziIOBase_NestedAtomically_closure)
#define Czh_static_info
(&
base_GHCziBase_Czh_static_info)
#define Fzh_static_info
(&
base_GHCziFloat_Fzh_static_info)
#define Dzh_static_info
(&
base_GHCziFloat_Dzh_static_info)
#define Azh_static_info
(&
base_Addr_Azh_static_info)
#define Izh_static_info
(&
base_GHCziBase_Izh_static_info)
#define I8zh_static_info
(&
base_GHCziInt_I8zh_static_info)
#define I16zh_static_info
(&
base_GHCziInt_I16zh_static_info)
#define I32zh_static_info
(&
base_GHCziInt_I32zh_static_info)
#define I64zh_static_info
(&
base_GHCziInt_I64zh_static_info)
#define Wzh_static_info
(&
base_GHCziWord_Wzh_static_info)
#define W8zh_static_info
(&
base_GHCziWord_W8zh_static_info)
#define W16zh_static_info
(&
base_GHCziWord_W16zh_static_info)
#define W32zh_static_info
(&
base_GHCziWord_W32zh_static_info)
#define W64zh_static_info
(&
base_GHCziWord_W64zh_static_info)
#define Ptr_static_info
(&
base_GHCziPtr_Ptr_static_info)
#define FunPtr_static_info
(&
base_GHCziPtr_FunPtr_static_info)
#define Czh_con_info
(&
base_GHCziBase_Czh_con_info)
#define Izh_con_info
(&
base_GHCziBase_Izh_con_info)
#define Fzh_con_info
(&
base_GHCziFloat_Fzh_con_info)
#define Dzh_con_info
(&
base_GHCziFloat_Dzh_con_info)
#define Azh_con_info
(&
base_Addr_Azh_con_info)
#define Wzh_con_info
(&
base_GHCziWord_Wzh_con_info)
#define W8zh_con_info
(&
base_GHCziWord_W8zh_con_info)
#define W16zh_con_info
(&
base_GHCziWord_W16zh_con_info)
#define W32zh_con_info
(&
base_GHCziWord_W32zh_con_info)
#define W64zh_con_info
(&
base_GHCziWord_W64zh_con_info)
#define I8zh_con_info
(&
base_GHCziInt_I8zh_con_info)
#define I16zh_con_info
(&
base_GHCziInt_I16zh_con_info)
#define I32zh_con_info
(&
base_GHCziInt_I32zh_con_info)
#define I64zh_con_info
(&
base_GHCziInt_I64zh_con_info)
#define I64zh_con_info
(&
base_GHCziInt_I64zh_con_info)
#define Ptr_con_info
(&
base_GHCziPtr_Ptr_con_info)
#define FunPtr_con_info
(&
base_GHCziPtr_FunPtr_con_info)
#define StablePtr_static_info
(&
base_GHCziStable_StablePtr_static_info)
#define StablePtr_con_info
(&
base_GHCziStable_StablePtr_con_info)
#define Czh_static_info
DLL_IMPORT_DATA_REF(
base_GHCziBase_Czh_static_info)
#define Fzh_static_info
DLL_IMPORT_DATA_REF(
base_GHCziFloat_Fzh_static_info)
#define Dzh_static_info
DLL_IMPORT_DATA_REF(
base_GHCziFloat_Dzh_static_info)
#define Azh_static_info
DLL_IMPORT_DATA_REF(
base_Addr_Azh_static_info)
#define Izh_static_info
DLL_IMPORT_DATA_REF(
base_GHCziBase_Izh_static_info)
#define I8zh_static_info
DLL_IMPORT_DATA_REF(
base_GHCziInt_I8zh_static_info)
#define I16zh_static_info
DLL_IMPORT_DATA_REF(
base_GHCziInt_I16zh_static_info)
#define I32zh_static_info
DLL_IMPORT_DATA_REF(
base_GHCziInt_I32zh_static_info)
#define I64zh_static_info
DLL_IMPORT_DATA_REF(
base_GHCziInt_I64zh_static_info)
#define Wzh_static_info
DLL_IMPORT_DATA_REF(
base_GHCziWord_Wzh_static_info)
#define W8zh_static_info
DLL_IMPORT_DATA_REF(
base_GHCziWord_W8zh_static_info)
#define W16zh_static_info
DLL_IMPORT_DATA_REF(
base_GHCziWord_W16zh_static_info)
#define W32zh_static_info
DLL_IMPORT_DATA_REF(
base_GHCziWord_W32zh_static_info)
#define W64zh_static_info
DLL_IMPORT_DATA_REF(
base_GHCziWord_W64zh_static_info)
#define Ptr_static_info
DLL_IMPORT_DATA_REF(
base_GHCziPtr_Ptr_static_info)
#define FunPtr_static_info
DLL_IMPORT_DATA_REF(
base_GHCziPtr_FunPtr_static_info)
#define Czh_con_info
DLL_IMPORT_DATA_REF(
base_GHCziBase_Czh_con_info)
#define Izh_con_info
DLL_IMPORT_DATA_REF(
base_GHCziBase_Izh_con_info)
#define Fzh_con_info
DLL_IMPORT_DATA_REF(
base_GHCziFloat_Fzh_con_info)
#define Dzh_con_info
DLL_IMPORT_DATA_REF(
base_GHCziFloat_Dzh_con_info)
#define Azh_con_info
DLL_IMPORT_DATA_REF(
base_Addr_Azh_con_info)
#define Wzh_con_info
DLL_IMPORT_DATA_REF(
base_GHCziWord_Wzh_con_info)
#define W8zh_con_info
DLL_IMPORT_DATA_REF(
base_GHCziWord_W8zh_con_info)
#define W16zh_con_info
DLL_IMPORT_DATA_REF(
base_GHCziWord_W16zh_con_info)
#define W32zh_con_info
DLL_IMPORT_DATA_REF(
base_GHCziWord_W32zh_con_info)
#define W64zh_con_info
DLL_IMPORT_DATA_REF(
base_GHCziWord_W64zh_con_info)
#define I8zh_con_info
DLL_IMPORT_DATA_REF(
base_GHCziInt_I8zh_con_info)
#define I16zh_con_info
DLL_IMPORT_DATA_REF(
base_GHCziInt_I16zh_con_info)
#define I32zh_con_info
DLL_IMPORT_DATA_REF(
base_GHCziInt_I32zh_con_info)
#define I64zh_con_info
DLL_IMPORT_DATA_REF(
base_GHCziInt_I64zh_con_info)
#define I64zh_con_info
DLL_IMPORT_DATA_REF(
base_GHCziInt_I64zh_con_info)
#define Ptr_con_info
DLL_IMPORT_DATA_REF(
base_GHCziPtr_Ptr_con_info)
#define FunPtr_con_info
DLL_IMPORT_DATA_REF(
base_GHCziPtr_FunPtr_con_info)
#define StablePtr_static_info
DLL_IMPORT_DATA_REF(
base_GHCziStable_StablePtr_static_info)
#define StablePtr_con_info
DLL_IMPORT_DATA_REF(
base_GHCziStable_StablePtr_con_info)
#endif
/* PRELUDE_H */
rts/RetainerProfile.c
View file @
006a18ea
...
...
@@ -364,8 +364,7 @@ find_srt( stackPos *info )
bitmap
=
info
->
next
.
srt
.
srt_bitmap
;
while
(
bitmap
!=
0
)
{
if
((
bitmap
&
1
)
!=
0
)
{
#ifdef ENABLE_WIN32_DLL_SUPPORT
#if defined(__PIC__) && defined(mingw32_TARGET_OS)
if
((
unsigned
long
)(
*
(
info
->
next
.
srt
.
srt
))
&
0x1
)
c
=
(
*
(
StgClosure
**
)((
unsigned
long
)
*
(
info
->
next
.
srt
.
srt
))
&
~
0x1
);
else
...
...
rts/RtsDllMain.c
View file @
006a18ea
...
...
@@ -15,8 +15,7 @@
#endif
/* I'd be mildly surprised if this wasn't defined, but still. */
#ifdef ENABLE_WIN32_DLL_SUPPORT
#if defined(__PIC__) && defined(mingw32_TARGET_OS)
BOOL
WINAPI
DllMain
(
HINSTANCE
hInstance
...
...
@@ -36,4 +35,4 @@ DllMain ( HINSTANCE hInstance
return
TRUE
;
}
#endif
/*
ENABLE_WIN32_DLL_SUPPORT
*/
#endif
/*
defined(__PIC__) && defined(mingw32_TARGET_OS)
*/
rts/StgMiscClosures.cmm
View file @
006a18ea
...
...
@@ -592,7 +592,7 @@ CLOSURE(stg_dummy_ret_closure,stg_dummy_ret);
replace them with references to the static objects.
------------------------------------------------------------------------- */
#if
defined
(
ENABLE_WIN32_DLL_SUPPORT
)
#if
defined
(
__PIC__
)
&&
defined
(
mingw32_TARGET_OS
)
/*
* When sticking the RTS in a DLL, we delay populating the
* Charlike and Intlike tables until load-time, which is only
...
...
rts/sm/Scav.c
View file @
006a18ea
...
...
@@ -77,7 +77,7 @@ scavenge_srt (StgClosure **srt, nat srt_bitmap)
while
(
bitmap
!=
0
)
{
if
((
bitmap
&
1
)
!=
0
)
{
#if
def ENABLE_WIN32_DLL_SUPPORT
#if
defined(__PIC__) && defined(mingw32_TARGET_OS)
// 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)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment