summaryrefslogtreecommitdiff
path: root/rts/Linker.c
diff options
context:
space:
mode:
authorSimon Marlow <simonmar@microsoft.com>2008-04-08 18:34:34 +0000
committerSimon Marlow <simonmar@microsoft.com>2008-04-08 18:34:34 +0000
commite0fcf61dca4dfac99cb5417e1bc4cbee18822cf2 (patch)
tree32382c35525e71b5f20dea714fb748b0870431e0 /rts/Linker.c
parent92986843271f2f400ebc0759b30eb11d47eaa193 (diff)
downloadhaskell-e0fcf61dca4dfac99cb5417e1bc4cbee18822cf2.tar.gz
Import libffi-3.0.4, and use it to provide FFI support in GHCi
This replaces the hand-rolled architecture-specific FFI support in GHCi with the standard libffi as used in GCJ, Python and other projects. I've bundled the complete libffi-3.0.4 tarball in the source tree in the same way as we do for GMP, the difference being that we always build and install our own libffi regardless of whether there's one on the system (it's small, and we don't want dependency/versioning headaches). In particular this means that unregisterised builds will now have a fully working GHCi including FFI out of the box, provided libffi supports the platform. There is also code in the RTS to use libffi in place of rts/Adjustor.c, but it is currently not enabled if we already have support in Adjustor.c for the current platform. We need to assess the performance impact before using libffi here too (in GHCi we don't care too much about performance).
Diffstat (limited to 'rts/Linker.c')
-rw-r--r--rts/Linker.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/rts/Linker.c b/rts/Linker.c
index 59143b9b0e..b193f014c3 100644
--- a/rts/Linker.c
+++ b/rts/Linker.c
@@ -441,6 +441,22 @@ typedef struct _RtsSymbolVal {
SymX(console_handler)
#endif
+#define RTS_LIBFFI_SYMBOLS \
+ Sym(ffi_prep_cif) \
+ Sym(ffi_call) \
+ Sym(ffi_type_void) \
+ Sym(ffi_type_float) \
+ Sym(ffi_type_double) \
+ Sym(ffi_type_sint64) \
+ Sym(ffi_type_uint64) \
+ Sym(ffi_type_sint32) \
+ Sym(ffi_type_uint32) \
+ Sym(ffi_type_sint16) \
+ Sym(ffi_type_uint16) \
+ Sym(ffi_type_sint8) \
+ Sym(ffi_type_uint8) \
+ Sym(ffi_type_pointer)
+
#ifdef TABLES_NEXT_TO_CODE
#define RTS_RET_SYMBOLS /* nothing */
#else
@@ -828,6 +844,7 @@ RTS_MINGW_ONLY_SYMBOLS
RTS_CYGWIN_ONLY_SYMBOLS
RTS_DARWIN_ONLY_SYMBOLS
RTS_LIBGCC_SYMBOLS
+RTS_LIBFFI_SYMBOLS
#undef Sym
#undef SymX
#undef SymX_redirect
@@ -860,6 +877,7 @@ static RtsSymbolVal rtsSyms[] = {
RTS_CYGWIN_ONLY_SYMBOLS
RTS_DARWIN_ONLY_SYMBOLS
RTS_LIBGCC_SYMBOLS
+ RTS_LIBFFI_SYMBOLS
#if defined(darwin_HOST_OS) && defined(i386_HOST_ARCH)
// dyld stub code contains references to this,
// but it should never be called because we treat