summaryrefslogtreecommitdiff
path: root/rts
diff options
context:
space:
mode:
Diffstat (limited to 'rts')
-rw-r--r--rts/Adjustor.c2
-rw-r--r--rts/Linker.c2
-rw-r--r--rts/LinkerInternals.h5
-rw-r--r--rts/StgCRun.c4
-rw-r--r--rts/ghc.mk11
-rw-r--r--rts/package.conf.in2
-rw-r--r--rts/rts.cabal.in2
-rw-r--r--rts/sm/Storage.c31
8 files changed, 43 insertions, 16 deletions
diff --git a/rts/Adjustor.c b/rts/Adjustor.c
index d360cfe87b..7fc931344c 100644
--- a/rts/Adjustor.c
+++ b/rts/Adjustor.c
@@ -99,7 +99,7 @@ freeHaskellFunctionPtr(void* ptr)
{
ffi_closure *cl;
-#if defined(ios_HOST_OS)
+#if defined(ios_HOST_OS) || defined(darwin_HOST_OS)
cl = execToWritable(ptr);
#else
cl = (ffi_closure*)ptr;
diff --git a/rts/Linker.c b/rts/Linker.c
index c0d28e6581..f0c72c3a2d 100644
--- a/rts/Linker.c
+++ b/rts/Linker.c
@@ -1484,7 +1484,7 @@ preloadObjectFile (pathchar *path)
*
* See also the misalignment logic for darwin below.
*/
-#if defined(ios_HOST_OS)
+#if defined(darwin_HOST_OS)
image = mmapForLinker(fileSize, PROT_READ|PROT_WRITE, MAP_PRIVATE, fd, 0);
#else
image = mmapForLinker(fileSize, PROT_READ|PROT_WRITE|PROT_EXEC,
diff --git a/rts/LinkerInternals.h b/rts/LinkerInternals.h
index b0fab81cb3..1a83771439 100644
--- a/rts/LinkerInternals.h
+++ b/rts/LinkerInternals.h
@@ -13,6 +13,11 @@
#include "linker/M32Alloc.h"
#if RTS_LINKER_USE_MMAP
+#if defined(ios_HOST_OS) || defined(darwin_HOST_OS)
+/* Inclusion of system headers usually requires _DARWIN_C_SOURCE on Mac OS X
+ * because of some specific defines like MMAP_ANON, MMAP_ANONYMOUS. */
+#define _DARWIN_C_SOURCE 1
+#endif
#include <sys/mman.h>
void* mmap_next(void *addr, size_t length, int prot, int flags, int fd, off_t offset);
#endif
diff --git a/rts/StgCRun.c b/rts/StgCRun.c
index 6ce50fcae8..1bb37a7acd 100644
--- a/rts/StgCRun.c
+++ b/rts/StgCRun.c
@@ -899,7 +899,7 @@ StgRun(StgFunPtr f, StgRegTable *basereg) {
".globl " STG_RETURN "\n\t"
THUMB_FUNC
-#if !defined(ios_HOST_OS)
+#if !(defined(ios_HOST_OS) || defined(darwin_HOST_OS))
".type " STG_RETURN ", %%function\n"
#endif
STG_RETURN ":\n\t"
@@ -982,7 +982,7 @@ StgRun(StgFunPtr f, StgRegTable *basereg) {
"br %1\n\t"
".globl " STG_RETURN "\n\t"
-#if !defined(ios_HOST_OS)
+#if !defined(ios_HOST_OS) && !defined(darwin_HOST_OS)
".type " STG_RETURN ", %%function\n"
#endif
STG_RETURN ":\n\t"
diff --git a/rts/ghc.mk b/rts/ghc.mk
index 451b1912cb..6a19217dac 100644
--- a/rts/ghc.mk
+++ b/rts/ghc.mk
@@ -17,7 +17,7 @@
rts_dist_HC = $(GHC_STAGE1)
rts_INSTALL_INFO = rts
-rts_VERSION = 1.0
+rts_VERSION = 1.0.1
# Minimum supported Windows version.
# These numbers can be found at:
@@ -329,8 +329,8 @@ $(eval $(call distdir-opts,rts,dist,1))
# We like plenty of warnings.
WARNING_OPTS += -Wall
WARNING_OPTS += -Wextra
-WARNING_OPTS += -Wstrict-prototypes
-WARNING_OPTS += -Wmissing-prototypes
+WARNING_OPTS += -Wstrict-prototypes
+WARNING_OPTS += -Wmissing-prototypes
WARNING_OPTS += -Wmissing-declarations
WARNING_OPTS += -Winline
WARNING_OPTS += -Wpointer-arith
@@ -346,7 +346,7 @@ WARNING_OPTS += -Wno-aggregate-return
#WARNING_OPTS += -Wshadow
#WARNING_OPTS += -Wcast-qual
-# This one seems buggy on GCC 4.1.2, which is the only GCC version we
+# This one seems buggy on GCC 4.1.2, which is the only GCC version we
# have that can bootstrap the SPARC build. We end up with lots of supurious
# warnings of the form "cast increases required alignment of target type".
# Some legitimate warnings can be fixed by adding an intermediate cast to
@@ -383,7 +383,7 @@ rts_CC_OPTS += -DUSE_LIBFFI_FOR_ADJUSTORS
endif
# We *want* type-checking of hand-written cmm.
-rts_HC_OPTS += -dcmm-lint
+rts_HC_OPTS += -dcmm-lint
# -fno-strict-aliasing is required for the runtime, because we often
# use a variety of types to represent closure pointers (StgPtr,
@@ -658,4 +658,3 @@ install_libffi_headers :
$(eval $(call clean-target,rts,dist,rts/dist))
BINDIST_EXTRAS += rts/package.conf.in
-
diff --git a/rts/package.conf.in b/rts/package.conf.in
index 6e1d19d588..b00d310f05 100644
--- a/rts/package.conf.in
+++ b/rts/package.conf.in
@@ -5,7 +5,7 @@
#include "MachDeps.h"
name: rts
-version: 1.0
+version: 1.0.1
id: rts
key: rts
license: BSD-3-Clause
diff --git a/rts/rts.cabal.in b/rts/rts.cabal.in
index 478e545589..9b6ba670a8 100644
--- a/rts/rts.cabal.in
+++ b/rts/rts.cabal.in
@@ -1,6 +1,6 @@
cabal-version: 3.0
name: rts
-version: 1.0
+version: 1.0.1
license: BSD-3-Clause
maintainer: glasgow-haskell-users@haskell.org
build-type: Simple
diff --git a/rts/sm/Storage.c b/rts/sm/Storage.c
index a88073d1f8..9c016b7fbb 100644
--- a/rts/sm/Storage.c
+++ b/rts/sm/Storage.c
@@ -30,10 +30,14 @@
#include "GC.h"
#include "Evac.h"
#include "NonMoving.h"
-#if defined(ios_HOST_OS)
+#if defined(ios_HOST_OS) || defined(darwin_HOST_OS)
#include "Hash.h"
#endif
+#if RTS_LINKER_USE_MMAP
+#include "LinkerInternals.h"
+#endif
+
#include <string.h>
#include "ffi.h"
@@ -1543,7 +1547,7 @@ StgWord calcTotalCompactW (void)
should be modified to use allocateExec instead of VirtualAlloc.
------------------------------------------------------------------------- */
-#if (defined(arm_HOST_ARCH) || defined(aarch64_HOST_ARCH)) && defined(ios_HOST_OS)
+#if (defined(arm_HOST_ARCH) || defined(aarch64_HOST_ARCH)) && (defined(ios_HOST_OS) || defined(darwin_HOST_OS))
#include <libkern/OSCacheControl.h>
#endif
@@ -1574,7 +1578,7 @@ void flushExec (W_ len, AdjustorExecutable exec_addr)
/* x86 doesn't need to do anything, so just suppress some warnings. */
(void)len;
(void)exec_addr;
-#elif (defined(arm_HOST_ARCH) || defined(aarch64_HOST_ARCH)) && defined(ios_HOST_OS)
+#elif (defined(arm_HOST_ARCH) || defined(aarch64_HOST_ARCH)) && (defined(ios_HOST_OS) || defined(darwin_HOST_OS))
/* On iOS we need to use the special 'sys_icache_invalidate' call. */
sys_icache_invalidate(exec_addr, len);
#elif defined(__clang__)
@@ -1628,7 +1632,7 @@ void freeExec (AdjustorExecutable addr)
RELEASE_SM_LOCK
}
-#elif defined(ios_HOST_OS)
+#elif defined(darwin_HOST_OS)
static HashTable* allocatedExecs;
@@ -1636,6 +1640,11 @@ AdjustorWritable allocateExec(W_ bytes, AdjustorExecutable *exec_ret)
{
AdjustorWritable writ;
ffi_closure* cl;
+ // This check is necessary as we can't use allocateExec for anything *but*
+ // ffi_closures on ios/darwin on arm. libffi does some heavy lifting to
+ // get around the X^W restrictions, and we can't just use this codepath
+ // to allocate generic executable space. For those cases we have to refer
+ // back to allocateWrite/markExec/freeWrite (see above.)
if (bytes != sizeof(ffi_closure)) {
barf("allocateExec: for ffi_closure only");
}
@@ -1753,6 +1762,20 @@ void freeExec (void *addr)
#endif /* switch(HOST_OS) */
+#if RTS_LINKER_USE_MMAP
+AdjustorWritable allocateWrite(W_ bytes) {
+ return mmapForLinker(bytes, PROT_READ | PROT_WRITE, MAP_ANONYMOUS, -1, 0);
+}
+
+void markExec(W_ bytes, AdjustorWritable writ) {
+ mmapForLinkerMarkExecutable(writ, bytes);
+}
+
+void freeWrite(W_ bytes, AdjustorWritable writ) {
+ munmap(writ, bytes);
+}
+#endif
+
#if defined(DEBUG)
// handy function for use in gdb, because Bdescr() is inlined.