summaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
authorErik de Castro Lopo <erikd@mega-nerd.com>2016-05-16 13:59:57 +1000
committerErik de Castro Lopo <erikd@mega-nerd.com>2016-05-17 06:25:16 +1000
commit4a037a9a933e043bdc08ae13bfbc846fe0e26ec9 (patch)
tree174abb3eae2783d82eacfb6446b76a1f10114ed1 /configure.ac
parent781442096b02a3dac7ab5ad6335f07b7edb569ea (diff)
downloadhaskell-4a037a9a933e043bdc08ae13bfbc846fe0e26ec9.tar.gz
Set `USE_MMAP` at configure time
Summary: The `USE_MMAP` macro is used in the run time linker and was being set with some really ugly CPP hackery. Setting in the configure script is much neater. Reviewers: rwbarton, hvr, austin, simonmar, bgamari Reviewed By: hvr, bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2223
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac28
1 files changed, 28 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac
index ff0dc054af..4adf9c5558 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1062,6 +1062,34 @@ if test "$use_large_address_space" = "yes" ; then
AC_DEFINE([USE_LARGE_ADDRESS_SPACE], [1], [Enable single heap address space support])
fi
+dnl ** Use MMAP in the runtime linker?
+dnl --------------------------------------------------------------
+
+case ${TargetOS} in
+ linux|freebsd|dragonfly|netbsd|openbsd|kfreebsdgnu|gnu|solaris2)
+ RtsLinkerUseMmap=1
+ ;;
+ darwin)
+ # Don't use mmap on powerpc/darwin as the mmap there doesn't support
+ # reallocating. Reallocating is needed to allocate jump islands just
+ # after each object image. Jumps to these jump islands use relative
+ # branches which are limited to offsets that can be represented in
+ # 24-bits.
+ if test "$TargetArch" != "powerpc" ; then
+ RtsLinkerUseMmap=1
+ else
+ RtsLinkerUseMmap=0
+ fi
+ ;;
+ *)
+ # Windows (which doesn't have mmap) and everything else.
+ RtsLinkerUseMmap=0
+ ;;
+ esac
+
+AC_DEFINE_UNQUOTED([RTS_LINKER_USE_MMAP], [$RtsLinkerUseMmap],
+ [Use mmap in the runtime linker])
+
dnl ** Have libdw?
dnl --------------------------------------------------------------
AC_ARG_ENABLE(libdw,