summaryrefslogtreecommitdiff
path: root/rts/Linker.c
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2020-11-23 15:15:09 -0500
committerMarge Bot <ben+marge-bot@smart-cactus.org>2020-12-01 19:58:18 -0500
commitc35d0e03514ce111ff8265426a7b911456984f50 (patch)
treecc6dcc192d544638be5a4fd7582f2876c5c56ddd /rts/Linker.c
parentd8872af08d205c3067371d56200e68cf2f0c1ffc (diff)
downloadhaskell-c35d0e03514ce111ff8265426a7b911456984f50.tar.gz
rts/m32: Introduce NEEDS_M32 macro
Instead of relying on RTS_LINKER_USE_MMAP
Diffstat (limited to 'rts/Linker.c')
-rw-r--r--rts/Linker.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/rts/Linker.c b/rts/Linker.c
index c84cfe27ba..57c76510d7 100644
--- a/rts/Linker.c
+++ b/rts/Linker.c
@@ -45,6 +45,8 @@
#include <sys/types.h>
#endif
+#include <fcntl.h>
+#include <unistd.h>
#include <inttypes.h>
#include <stdlib.h>
#include <string.h>
@@ -1327,10 +1329,10 @@ void freeObjectCode (ObjectCode *oc)
oc->sections[i].mapped_size,
"freeObjectCode");
break;
+#endif
case SECTION_M32:
// Freed by m32_allocator_free
break;
-#endif
case SECTION_MALLOC:
IF_DEBUG(zero_on_gc,
memset(oc->sections[i].start,
@@ -1373,7 +1375,7 @@ void freeObjectCode (ObjectCode *oc)
ocDeinit_ELF(oc);
#endif
-#if RTS_LINKER_USE_MMAP == 1
+#if defined(NEED_M32)
m32_allocator_free(oc->rx_m32);
m32_allocator_free(oc->rw_m32);
#endif
@@ -1451,7 +1453,7 @@ mkOc( ObjectType type, pathchar *path, char *image, int imageSize,
oc->mark = object_code_mark_bit;
oc->dependencies = allocHashSet();
-#if RTS_LINKER_USE_MMAP
+#if defined(NEED_M32)
oc->rw_m32 = m32_allocator_new(false);
oc->rx_m32 = m32_allocator_new(true);
#endif
@@ -1788,7 +1790,7 @@ int ocTryLoad (ObjectCode* oc) {
// We have finished loading and relocating; flush the m32 allocators to
// setup page protections.
-#if RTS_LINKER_USE_MMAP
+#if defined(NEED_M32)
m32_allocator_flush(oc->rx_m32);
m32_allocator_flush(oc->rw_m32);
#endif