Commit b3bd828c authored by Ian Lynagh's avatar Ian Lynagh
Browse files

Fix the build on OS X

parent e0f75029
......@@ -9,6 +9,10 @@
#ifndef RTS_FILELOCK_H
#define RTS_FILELOCK_H
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
int lockFile(int fd, dev_t dev, ino_t ino, int for_writing);
int unlockFile(int fd);
......
......@@ -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;
......
......@@ -9,6 +9,8 @@
#ifndef POSIXSOURCE_H
#define POSIXSOURCE_H
#include <ghcplatform.h>
#define _POSIX_SOURCE 1
#define _POSIX_C_SOURCE 199506L
#define _XOPEN_SOURCE 500
......@@ -16,4 +18,12 @@
/* Let's be ISO C99 too... */
#if defined(darwin_HOST_OS)
/* If we don't define this the including sysctl breaks with things like
/usr/include/bsm/audit.h:224:0:
error: syntax error before 'u_char'
*/
#define _DARWIN_C_SOURCE 1
#endif
#endif /* POSIXSOURCE_H */
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment