summaryrefslogtreecommitdiff
path: root/rts/LinkerInternals.h
diff options
context:
space:
mode:
authorMoritz Angermann <moritz.angermann@gmail.com>2021-02-13 16:44:19 +0800
committerMarge Bot <ben+marge-bot@smart-cactus.org>2021-03-29 17:25:49 -0400
commite754ff7f178a629a2261cba77a29d9510391aebd (patch)
tree77aca9f315288b52efbc9d410a57300a4029279d /rts/LinkerInternals.h
parent4421fb34b3a70db1323833337c94ac4364824124 (diff)
downloadhaskell-e754ff7f178a629a2261cba77a29d9510391aebd.tar.gz
Allocate Adjustors and mark them readable in two steps
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 'rts/LinkerInternals.h')
-rw-r--r--rts/LinkerInternals.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/rts/LinkerInternals.h b/rts/LinkerInternals.h
index 444849fbac..4be364cdb8 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>
#endif