summaryrefslogtreecommitdiffstats
path: root/tools/ghc/ghc-powerpc-linker-mmap.patch
blob: df0d5ffe8c9ad72daaf6e7eb9a1b7af59fd50f53 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
diff -up ghc-7.0.2/rts/Linker.c.fix-powerpc ghc-7.0.2/rts/Linker.c
--- ghc-7.0.2/rts/Linker.c.fix-powerpc	2011-02-28 19:10:08.000000000 +0100

+++ ghc-7.0.2/rts/Linker.c	2011-04-25 22:20:10.781092305 +0200

@@ -70,11 +70,12 @@
 #include <sys/wait.h>
 #endif
 
-#if defined(linux_HOST_OS    ) || defined(freebsd_HOST_OS) || \

-    defined(dragonfly_HOST_OS) || defined(netbsd_HOST_OS ) || \

-    defined(openbsd_HOST_OS  ) || \

-    ( defined(darwin_HOST_OS ) && !defined(powerpc_HOST_ARCH) )

-/* Don't use mmap on powerpc-apple-darwin as mmap doesn't support

+#if !defined(powerpc_HOST_ARCH) && \

+    (   defined(linux_HOST_OS    ) || defined(freebsd_HOST_OS) || \

+        defined(dragonfly_HOST_OS) || defined(netbsd_HOST_OS ) || \

+        defined(openbsd_HOST_OS  ) || defined(darwin_HOST_OS ) || \

+        defined(kfreebsdgnu_HOST_OS) )

+/* Don't use mmap on powerpc_HOST_ARCH as mmap doesn't support

  * reallocating but we need to allocate jump islands just after each
  * object images. Otherwise relative branches to jump islands can fail
  * due to 24-bits displacement overflow.
@@ -2436,7 +2437,11 @@ static void ocFlushInstructionCacheFrom(
 static void ocFlushInstructionCache( ObjectCode *oc )
 {
     /* The main object code */
-    ocFlushInstructionCacheFrom(oc->image + oc->misalignment, oc->fileSize);

+    ocFlushInstructionCacheFrom(oc->image

+#ifdef darwin_HOST_OS

+            + oc->misalignment

+#endif

+            , oc->fileSize);

 
     /* Jump Islands */
     ocFlushInstructionCacheFrom(oc->symbol_extras, sizeof(SymbolExtra) * oc->n_symbol_extras);