about summary refs log tree commit diff
path: root/pkgs/development/compilers
diff options
context:
space:
mode:
authorThomas Tuegel <ttuegel@gmail.com>2016-09-01 12:07:36 -0500
committerThomas Tuegel <ttuegel@gmail.com>2016-09-01 12:07:36 -0500
commit54125b4af4e0788f1f72580aa4dbda7f57db0ff7 (patch)
tree2b19b1baaf05d4558e770df22f9eba547050c839 /pkgs/development/compilers
parent571ee39714f2488ffef3432dd588c6f4af91dcad (diff)
downloadnixlib-54125b4af4e0788f1f72580aa4dbda7f57db0ff7.tar
nixlib-54125b4af4e0788f1f72580aa4dbda7f57db0ff7.tar.gz
nixlib-54125b4af4e0788f1f72580aa4dbda7f57db0ff7.tar.bz2
nixlib-54125b4af4e0788f1f72580aa4dbda7f57db0ff7.tar.lz
nixlib-54125b4af4e0788f1f72580aa4dbda7f57db0ff7.tar.xz
nixlib-54125b4af4e0788f1f72580aa4dbda7f57db0ff7.tar.zst
nixlib-54125b4af4e0788f1f72580aa4dbda7f57db0ff7.zip
ghc801: disable MADV_FREE
Diffstat (limited to 'pkgs/development/compilers')
-rw-r--r--pkgs/development/compilers/ghc/8.0.1.nix2
-rw-r--r--pkgs/development/compilers/ghc/ghc-no-madv-free.patch18
2 files changed, 19 insertions, 1 deletions
diff --git a/pkgs/development/compilers/ghc/8.0.1.nix b/pkgs/development/compilers/ghc/8.0.1.nix
index d28eab8d25e2..e607ef7e2706 100644
--- a/pkgs/development/compilers/ghc/8.0.1.nix
+++ b/pkgs/development/compilers/ghc/8.0.1.nix
@@ -28,7 +28,7 @@ stdenv.mkDerivation rec {
     # Fix https://ghc.haskell.org/trac/ghc/ticket/12130
     (fetchFilteredPatch { url = https://git.haskell.org/ghc.git/patch/4d71cc89b4e9648f3fbb29c8fcd25d725616e265; sha256 = "0syaxb4y4s2dc440qmrggb4vagvqqhb55m6mx12rip4i9qhxl8k0"; })
     (fetchFilteredPatch { url = https://git.haskell.org/ghc.git/patch/2f8cd14fe909a377b3e084a4f2ded83a0e6d44dd; sha256 = "06zvlgcf50ab58bw6yw3krn45dsmhg4cmlz4nqff8k4z1f1bj01v"; })
-  ];
+  ] ++ stdenv.lib.optional stdenv.isLinux ./ghc-no-madv-free.patch;
 
   buildInputs = [ ghc perl hscolour ];
 
diff --git a/pkgs/development/compilers/ghc/ghc-no-madv-free.patch b/pkgs/development/compilers/ghc/ghc-no-madv-free.patch
new file mode 100644
index 000000000000..8fea9f920126
--- /dev/null
+++ b/pkgs/development/compilers/ghc/ghc-no-madv-free.patch
@@ -0,0 +1,18 @@
+diff --git a/rts/posix/OSMem.c b/rts/posix/OSMem.c
+index 99620ee..e052a84 100644
+--- a/rts/posix/OSMem.c
++++ b/rts/posix/OSMem.c
+@@ -523,13 +523,7 @@ void osDecommitMemory(void *at, W_ size)
+         sysErrorBelch("unable to make released memory unaccessible");
+ #endif
+ 
+-#ifdef MADV_FREE
+-    // Try MADV_FREE first, FreeBSD has both and MADV_DONTNEED
+-    // just swaps memory out
+-    r = madvise(at, size, MADV_FREE);
+-#else
+     r = madvise(at, size, MADV_DONTNEED);
+-#endif
+     if(r < 0)
+         sysErrorBelch("unable to decommit memory");
+ }