summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGracjan Polak <gracjanpolak@gmail.com>2016-12-23 14:37:08 -0500
committerBen Gamari <ben@smart-cactus.org>2016-12-23 16:44:48 -0500
commit2689a1692636521777f007861a484e7064b2d696 (patch)
tree918b6eb6589b66db9918d00b62352020f82b6205
parent94d2cce6742235d36efb71cf704acd1327a68481 (diff)
downloadhaskell-2689a1692636521777f007861a484e7064b2d696.tar.gz
Define MAP_ANONYMOUS on systems that only provide MAP_ANON
Reviewers: simonmar, erikd, austin, bgamari Reviewed By: bgamari Subscribers: gracjan, rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D2881 GHC Trac Issues: #13005
-rw-r--r--rts/LinkerInternals.h10
-rw-r--r--rts/linker/M32Alloc.h5
2 files changed, 10 insertions, 5 deletions
diff --git a/rts/LinkerInternals.h b/rts/LinkerInternals.h
index a09d079758..76497df257 100644
--- a/rts/LinkerInternals.h
+++ b/rts/LinkerInternals.h
@@ -12,6 +12,10 @@
#include "Rts.h"
#include "Hash.h"
+#if RTS_LINKER_USE_MMAP
+#include <sys/mman.h>
+#endif
+
#include "BeginPrivate.h"
typedef void SymbolAddr;
@@ -288,6 +292,12 @@ char *cstring_from_section_name(
unsigned char* strtab);
#endif /* mingw32_HOST_OS */
+/* MAP_ANONYMOUS is MAP_ANON on some systems,
+ e.g. OS X (before Sierra), OpenBSD etc */
+#if !defined(MAP_ANONYMOUS) && defined(MAP_ANON)
+#define MAP_ANONYMOUS MAP_ANON
+#endif
+
/* Which object file format are we targetting? */
#if defined(linux_HOST_OS) || defined(solaris2_HOST_OS) || defined(freebsd_HOST_OS) || defined(kfreebsdgnu_HOST_OS) || defined(dragonfly_HOST_OS) || defined(netbsd_HOST_OS) || defined(openbsd_HOST_OS) || defined(gnu_HOST_OS)
# define OBJFORMAT_ELF
diff --git a/rts/linker/M32Alloc.h b/rts/linker/M32Alloc.h
index db3d8c0f7c..8ec49cae21 100644
--- a/rts/linker/M32Alloc.h
+++ b/rts/linker/M32Alloc.h
@@ -19,11 +19,6 @@
#endif
-/* MAP_ANONYMOUS is MAP_ANON on some systems, e.g. OS X, OpenBSD etc */
-#if !defined(MAP_ANONYMOUS) && defined(MAP_ANON)
-#define MAP_ANONYMOUS MAP_ANON
-#endif
-
#include "BeginPrivate.h"
#if RTS_LINKER_USE_MMAP