summaryrefslogtreecommitdiff
path: root/rts/Adjustor.c
diff options
context:
space:
mode:
authorIan Lynagh <igloo@earth.li>2009-08-07 15:21:51 +0000
committerIan Lynagh <igloo@earth.li>2009-08-07 15:21:51 +0000
commitb3bd828c358cbd79887dbd873357e265d8d6060a (patch)
treef8d27801cd027b324ce7946f5b9473d4f6d5007a /rts/Adjustor.c
parente0f750296ef29dc073f80d4e60e48c1db4a15a35 (diff)
downloadhaskell-b3bd828c358cbd79887dbd873357e265d8d6060a.tar.gz
Fix the build on OS X
Diffstat (limited to 'rts/Adjustor.c')
-rw-r--r--rts/Adjustor.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/rts/Adjustor.c b/rts/Adjustor.c
index aa7a809029..dcae59b41b 100644
--- a/rts/Adjustor.c
+++ b/rts/Adjustor.c
@@ -43,10 +43,20 @@ Haskell side.
#include "Stable.h"
#if defined(USE_LIBFFI_FOR_ADJUSTORS)
-
#include "ffi.h"
#include <string.h>
+#endif
+
+#if defined(i386_HOST_ARCH) && defined(darwin_HOST_OS)
+extern void adjustorCode(void);
+#elif defined(powerpc_HOST_ARCH) || defined(powerpc64_HOST_ARCH)
+// from AdjustorAsm.s
+// not declared as a function so that AIX-style
+// fundescs can never get in the way.
+extern void *adjustorCode;
+#endif
+#if defined(USE_LIBFFI_FOR_ADJUSTORS)
void
freeHaskellFunctionPtr(void* ptr)
{
@@ -423,7 +433,6 @@ createAdjustor(int cconv, StgStablePtr hptr,
AdjustorStub *adjustorStub = allocateExec(sizeof(AdjustorStub),&code);
adjustor = adjustorStub;
- extern void adjustorCode(void);
int sz = totalArgumentSize(typeString);
adjustorStub->call[0] = 0xe8;
@@ -915,11 +924,6 @@ TODO: Depending on how much allocation overhead stgMallocBytes uses for
AdjustorStub *adjustorStub;
int sz = 0, extra_sz, total_sz;
- // from AdjustorAsm.s
- // not declared as a function so that AIX-style
- // fundescs can never get in the way.
- extern void *adjustorCode;
-
#ifdef FUNDESCS
adjustorStub = stgMallocBytes(sizeof(AdjustorStub), "createAdjustor");
#else
@@ -1154,7 +1158,6 @@ if ( *(unsigned char*)ptr != 0xe8 ) {
}
freeStablePtr(((StgStablePtr*)ptr)[1]);
#elif defined(powerpc_HOST_ARCH) || defined(powerpc64_HOST_ARCH)
- extern void* adjustorCode;
if ( ((AdjustorStub*)ptr)->code != (StgFunPtr) &adjustorCode ) {
errorBelch("freeHaskellFunctionPtr: not for me, guv! %p\n", ptr);
return;