summaryrefslogtreecommitdiff
path: root/includes
diff options
context:
space:
mode:
authorMoritz Angermann <moritz.angermann@gmail.com>2021-02-13 16:44:19 +0800
committerMoritz Angermann <moritz.angermann@gmail.com>2021-02-17 21:09:55 +0800
commit9a1aa9fbee2fea8b85eeb5f80b748140efe9999e (patch)
tree06973ea9ea59104c970f87bb0fe54f2e45cd0d88 /includes
parent5109e87e13ab45d799db2013535f54ca35f1f4dc (diff)
downloadhaskell-wip/angerman/adjustor-alloc-mark-split.tar.gz
Allocate Adjustors and mark them readable in two stepswip/angerman/adjustor-alloc-mark-split
This drops allocateExec for darwin, and replaces it with a alloc, write, mark executable strategy instead. This prevents us from trying to allocate an executable range and then write to it, which X^W will prohibit on darwin. This will *only* work if we can use mmap.
Diffstat (limited to 'includes')
-rw-r--r--includes/Rts.h6
-rw-r--r--includes/rts/storage/GC.h8
2 files changed, 13 insertions, 1 deletions
diff --git a/includes/Rts.h b/includes/Rts.h
index 1db3ea0df8..568a7e6108 100644
--- a/includes/Rts.h
+++ b/includes/Rts.h
@@ -29,6 +29,12 @@ extern "C" {
#include <windows.h>
#endif
+#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
+
#if !defined(IN_STG_CODE)
#define IN_STG_CODE 0
#endif
diff --git a/includes/rts/storage/GC.h b/includes/rts/storage/GC.h
index 889df9a675..be9c13cdf4 100644
--- a/includes/rts/storage/GC.h
+++ b/includes/rts/storage/GC.h
@@ -199,9 +199,15 @@ typedef void* AdjustorExecutable;
AdjustorWritable allocateExec(W_ len, AdjustorExecutable *exec_addr);
void flushExec(W_ len, AdjustorExecutable exec_addr);
-#if defined(ios_HOST_OS)
+#if (defined(arm_HOST_ARCH) || defined(aarch64_HOST_ARCH)) && (defined(ios_HOST_OS) || defined(darwin_HOST_OS))
AdjustorWritable execToWritable(AdjustorExecutable exec);
#endif
+
+#if RTS_LINKER_USE_MMAP
+AdjustorWritable allocateWrite(W_ bytes);
+void markExec(W_ bytes, AdjustorWritable writ);
+void freeWrite(W_ bytes, AdjustorWritable writ);
+#endif
void freeExec (AdjustorExecutable p);
// Used by GC checks in external .cmm code: