summaryrefslogtreecommitdiff
path: root/rts/LinkerInternals.h
diff options
context:
space:
mode:
authorShea Levy <shea@shealevy.com>2016-11-15 22:01:20 -0500
committerBen Gamari <ben@smart-cactus.org>2016-11-15 22:01:37 -0500
commita637eeb7a1852adfd99b06d2c0a3496e4f238a0c (patch)
treecab7490a0d78ed776c7caadc6a8d779c8f7b50bb /rts/LinkerInternals.h
parent4a835f0890b4848b32129ab11ceb29cb0a0769f6 (diff)
downloadhaskell-a637eeb7a1852adfd99b06d2c0a3496e4f238a0c.tar.gz
Don't use mmap symbols when !RTS_LINKER_USE_MMAP
Some usages of symbols from sys/mman.h are guarded by RTS_LINKER_USE_MMAP by C conditionals, not CPP conditionals. Since those branches are dead anyway when !RTS_LINKER_USE_MMAP, we just stub out the relevant symbols rather than increasing CPP branching. Fixes #12839. Reviewers: simonmar, austin, bgamari, erikd Reviewed By: simonmar, bgamari, erikd Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2710 GHC Trac Issues: #12839
Diffstat (limited to 'rts/LinkerInternals.h')
-rw-r--r--rts/LinkerInternals.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/rts/LinkerInternals.h b/rts/LinkerInternals.h
index 60370bbcd2..4806d53a9a 100644
--- a/rts/LinkerInternals.h
+++ b/rts/LinkerInternals.h
@@ -303,4 +303,14 @@ char *cstring_from_section_name(
# define OBJFORMAT_MACHO
#endif
+/* In order to simplify control flow a bit, some references to mmap-related
+ definitions are blocked off by a C-level if statement rather than a CPP-level
+ #if statement. Since those are dead branches when !RTS_LINKER_USE_MMAP, we
+ just stub out the relevant symbols here
+*/
+#if !RTS_LINKER_USE_MMAP
+#define munmap(x,y) /* nothing */
+#define MAP_ANONYMOUS 0
+#endif
+
#endif /* LINKERINTERNALS_H */