[Pkg-haskell-commits] darcs: ghc: Add patches/fix-ppc-ghci-segfault.
Erik de Castro Lopo
erikd at mega-nerd.com
Sun Jul 15 00:30:19 UTC 2012
Sun Jul 15 00:28:16 UTC 2012 Erik de Castro Lopo <erikd at mega-nerd.com>
* Add patches/fix-ppc-ghci-segfault.
Ignore-this: f54c178c7f49103ca681cb8d89350e60
A ./patches/fix-ppc-ghci-segfault
Sun Jul 15 00:28:16 UTC 2012 Erik de Castro Lopo <erikd at mega-nerd.com>
* Add patches/fix-ppc-ghci-segfault.
Ignore-this: f54c178c7f49103ca681cb8d89350e60
diff -rN -u old-ghc//patches/fix-ppc-ghci-segfault new-ghc//patches/fix-ppc-ghci-segfault
--- old-ghc//patches/fix-ppc-ghci-segfault 1970-01-01 00:00:00.000000000 +0000
+++ new-ghc//patches/fix-ppc-ghci-segfault 2012-07-15 00:30:17.518324903 +0000
@@ -0,0 +1,46 @@
+Description: Use contiguous mmap for PowerPC when allocating symbol_extras
+Author: Ben Collins <bcollins at ubuntu.com>
+Bug-GHC: http://hackage.haskell.org/trac/ghc/ticket/2972
+Forwarded: Yes
+
+--- ghc-7.4.1.orig/rts/Linker.c
++++ ghc-7.4.1/rts/Linker.c
+@@ -84,6 +84,11 @@
+ #include <fcntl.h>
+ #include <sys/mman.h>
+
++#if defined(powerpc_HOST_ARCH)
++/* We need to keep image and symbol_extras in the same contiguous space */
++#define MMAP_CONTIGUOUS
++#endif
++
+ #ifdef HAVE_UNISTD_H
+ #include <unistd.h>
+ #endif
+@@ -2514,8 +2519,25 @@ static int ocAllocateSymbolExtras( Objec
+ */
+ if( m > n ) // we need to allocate more pages
+ {
++#if defined(MMAP_CONTIGUOUS)
++ /* Keep image and symbol_extras contiguous */
++ void *new = mmapForLinker(n + (sizeof(SymbolExtra) * count),
++ MAP_ANONYMOUS, -1);
++ if (new)
++ {
++ memcpy(new, oc->image, oc->fileSize);
++ munmap(oc->image, n);
++ oc->image = new;
++ oc->symbol_extras = (SymbolExtra *) (oc->image + n);
++ }
++ else
++ {
++ oc->symbol_extras = NULL;
++ }
++#else
+ oc->symbol_extras = mmapForLinker(sizeof(SymbolExtra) * count,
+ MAP_ANONYMOUS, -1);
++#endif
+ }
+ else
+ {
+
More information about the Pkg-haskell-commits
mailing list