summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergei Trofimovich <slyfox@gentoo.org>2010-07-09 15:03:24 +0000
committerSergei Trofimovich <slyfox@gentoo.org>2010-07-09 15:03:24 +0000
commit539a7f64c70c7fa3492ca65415e12c6d3b39f5de (patch)
treeaaf312023bf939c3df9c48d668ea8d2ddcb6f5b3 /dev-lang/ghc/files
parentmarked ~ia64 (diff)
downloadgentoo-2-539a7f64c70c7fa3492ca65415e12c6d3b39f5de.tar.gz
gentoo-2-539a7f64c70c7fa3492ca65415e12c6d3b39f5de.tar.bz2
gentoo-2-539a7f64c70c7fa3492ca65415e12c6d3b39f5de.zip
Marked ~ia64 (as now we have ia64 binaries for ghc)
(Portage version: 2.1.8.3/cvs/Linux x86_64)
Diffstat (limited to 'dev-lang/ghc/files')
-rw-r--r--dev-lang/ghc/files/ghc-6.10.4-ia64-fixed-relax.patch35
-rw-r--r--dev-lang/ghc/files/ghc-6.10.4-ia64-storage-manager-fix.patch63
-rw-r--r--dev-lang/ghc/files/ghc-6.12.3-ia64-fixed-relax.patch35
-rw-r--r--dev-lang/ghc/files/ghc-6.12.3-ia64-storage-manager-fix.patch62
4 files changed, 195 insertions, 0 deletions
diff --git a/dev-lang/ghc/files/ghc-6.10.4-ia64-fixed-relax.patch b/dev-lang/ghc/files/ghc-6.10.4-ia64-fixed-relax.patch
new file mode 100644
index 000000000000..b9fa2925bb69
--- /dev/null
+++ b/dev-lang/ghc/files/ghc-6.10.4-ia64-fixed-relax.patch
@@ -0,0 +1,35 @@
+commit dcdb5df8bc0e973b856e88a7b78f88f947453feb
+Author: Sergei Trofimovich <slyfox@gentoo.org>
+Date: Tue Jul 6 11:38:47 2010 +0300
+
+ Fixing link failure of compiler on ia64 ('-Wl,' prefixed value passed directly to ld)
+
+ /usr/bin/ld -Wl,--relax -r -o dist-stage1/build/HSghc-6.10.4.o \
+ dist-stage1/build/BasicTypes.o dist-stage1/build/DataCon.o ...
+ /usr/bin/ld: unrecognized option '-Wl,--relax'
+
+ If we just drop '-Wl,' part it will not help as '-r' and '--relax' are incompatible.
+
+ Looks like '-Wl,--relax' was skipped by earlier binutils' ld as unknown option.
+ Removing ia64 specific path.
+
+ Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
+
+diff --git a/compiler/Makefile b/compiler/Makefile
+index 0e7457b..17deab2 100644
+--- a/compiler/Makefile
++++ b/compiler/Makefile
+@@ -130,13 +130,6 @@ ifeq "$(TargetOS_CPP)" "openbsd"
+ COMMON_CONFIGURE_FLAGS += --ld-options=-E
+ endif
+
+-ifeq "$(GhcUnregisterised)" "NO"
+-ifeq "$(HOSTPLATFORM)" "ia64-unknown-linux"
+-# needed for generating proper relocation in large binaries: trac #856
+-COMMON_CONFIGURE_FLAGS += --ld-option=-Wl,--relax
+-endif
+-endif
+-
+ # We need to turn on profiling either if we have been asked to
+ # (GhcLibProfiled = YES) or if we want GHC itself to be compiled with
+ # profiling enabled (GhcProfiled = YES).
diff --git a/dev-lang/ghc/files/ghc-6.10.4-ia64-storage-manager-fix.patch b/dev-lang/ghc/files/ghc-6.10.4-ia64-storage-manager-fix.patch
new file mode 100644
index 000000000000..37daea5d55ca
--- /dev/null
+++ b/dev-lang/ghc/files/ghc-6.10.4-ia64-storage-manager-fix.patch
@@ -0,0 +1,63 @@
+storage manager: preserve upper address bits on 64bit machines (thanks to zygoloid)
+
+the issue: durin ia64 ghc bootstrap (both 6.10.4 and 6.12.3) I
+got the failure on stage2 phase:
+ "inplace/bin/ghc-stage2" -H32m -O -H64m -O0 -w ...
+ ghc-stage2: internal error: evacuate: strange closure type 15
+ (GHC version 6.12.3 for ia64_unknown_linux)
+ Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug
+ make[1]: *** [libraries/dph/dph-base/dist-install/build/Data/Array/Parallel/Base/Hyperstrict.o] Aborted
+
+I attached gdb and got backtrace:
+
+Breakpoint 1 at 0x400000000469ec31: file rts/RtsMessages.c, line 39.
+(gdb) run -B/var/tmp/portage/dev-lang/ghc-6.12.3/work/ghc-6.12.3/inplace/bin --info
+Starting program: /var/tmp/portage/dev-lang/ghc-6.12.3/work/ghc-6.12.3/inplace/lib/ghc-stage2 -B/var/tmp/portage/dev-lang/
+ghc-6.12.3/work/ghc-6.12.3/inplace/bin --info
+[Thread debugging using libthread_db enabled]
+
+Breakpoint 1, barf (s=0x40000000047915b0 "evacuate: strange closure type %d") at rts/RtsMessages.c:39
+39 va_start(ap,s);
+(gdb) bt
+#0 barf (s=0x40000000047915b0 "evacuate: strange closure type %d") at rts/RtsMessages.c:39
+#1 0x400000000474a1e0 in evacuate (p=0x6000000000147958) at rts/sm/Evac.c:756
+#2 0x40000000046d68c0 in scavenge_srt (srt=0x6000000000147958, srt_bitmap=7) at rts/sm/Scav.c:348
+...
+
+> 16:52:53 < zygoloid> slyfox: i'm no ghc expert but it looks like HEAP_ALLOCED_GC(q)
+> is returning true for a FUN_STATIC closure
+> 17:18:43 < zygoloid> try: p HEAP_ALLOCED_miss((unsigned long)(*p) >> 20, *p)
+> 17:19:12 < slyfox> (gdb) p HEAP_ALLOCED_miss((unsigned long)(*p) >> 20, *p)
+> 17:19:12 < slyfox> $1 = 0
+> 17:19:40 < zygoloid> i /think/ that means the mblock_cache is broken
+> 17:22:45 < zygoloid> i can't help further. however i am suspicious that you seem to have pointers with similar-looking low 33
+> bits and different high 4 bits, and it looks like such pointers get put into the same bucket in
+> mblock_cache.
+...
+> 17:36:16 < zygoloid> slyfox: try changing the definition of MbcCacheLine to StgWord64, see if that helps
+> 17:36:31 < zygoloid> that's in includes/rts/storage/MBlock.h
+And it helped!
+
+diff --git a/rts/sm/MBlock.h b/rts/sm/MBlock.h
+index 516fb7f..725d32f 100644
+--- a/rts/sm/MBlock.h
++++ b/rts/sm/MBlock.h
+@@ -117,7 +117,17 @@ extern StgWord8 mblock_map[];
+
+ #define MBC_LINE_BITS 0
+ #define MBC_TAG_BITS 15
+-typedef StgWord32 MbcCacheLine; // could use 16, but 32 was faster
++
++#if x86_64_HOST_ARCH
++// 32bits are enough for 'entry' as modern amd64 boxes have
++// only 48bit sized virtual addres.
++typedef StgWord32 MbcCacheLine;
++#else
++// 32bits is not enough here as some arches (like ia64) use
++// upper address bits to distinct memory areas.
++typedef StgWord64 MbcCacheLine;
++#endif
++
+ typedef StgWord8 MBlockMapLine;
+
+ #define MBLOCK_MAP_LINE(p) (((StgWord)p & 0xffffffff) >> (MBLOCK_SHIFT + MBC_LINE_BITS))
diff --git a/dev-lang/ghc/files/ghc-6.12.3-ia64-fixed-relax.patch b/dev-lang/ghc/files/ghc-6.12.3-ia64-fixed-relax.patch
new file mode 100644
index 000000000000..37bfab110fd0
--- /dev/null
+++ b/dev-lang/ghc/files/ghc-6.12.3-ia64-fixed-relax.patch
@@ -0,0 +1,35 @@
+commit 7b45030b81fb0588b858400c051f9f7c10ef2760
+Author: Sergei Trofimovich <slyfox@gentoo.org>
+Date: Tue Jul 6 11:39:18 2010 +0300
+
+ Fixing link failure of compiler on ia64 ('-Wl,' prefixed value passed directly to ld)
+
+ /usr/bin/ld -Wl,--relax -r -o dist-stage1/build/HSghc-6.10.4.o \
+ dist-stage1/build/BasicTypes.o dist-stage1/build/DataCon.o ...
+ /usr/bin/ld: unrecognized option '-Wl,--relax'
+
+ If we just drop '-Wl,' part it will not help as '-r' and '--relax' are incompatible.
+
+ Looks like '-Wl,--relax' was skipped by earlier binutils' ld as unknown option.
+ Removing ia64 specific path.
+
+ Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
+
+diff --git a/compiler/ghc.mk b/compiler/ghc.mk
+index 6b25efa..29d3ade 100644
+--- a/compiler/ghc.mk
++++ b/compiler/ghc.mk
+@@ -337,13 +337,6 @@ ifeq "$(TargetOS_CPP)" "openbsd"
+ compiler_CONFIGURE_OPTS += --ld-options=-E
+ endif
+
+-ifeq "$(GhcUnregisterised)" "NO"
+-ifeq "$(HOSTPLATFORM)" "ia64-unknown-linux"
+-# needed for generating proper relocation in large binaries: trac #856
+-compiler_CONFIGURE_OPTS += --ld-option=-Wl,--relax
+-endif
+-endif
+-
+ # We need to turn on profiling either if we have been asked to
+ # (GhcLibProfiled = YES) or if we want GHC itself to be compiled with
+ # profiling enabled (GhcProfiled = YES).
diff --git a/dev-lang/ghc/files/ghc-6.12.3-ia64-storage-manager-fix.patch b/dev-lang/ghc/files/ghc-6.12.3-ia64-storage-manager-fix.patch
new file mode 100644
index 000000000000..1458dcc7d8b6
--- /dev/null
+++ b/dev-lang/ghc/files/ghc-6.12.3-ia64-storage-manager-fix.patch
@@ -0,0 +1,62 @@
+storage manager: preserve upper address bits on 64bit machines (thanks to zygoloid)
+
+the issue: durin ia64 ghc bootstrap (both 6.10.4 and 6.12.3) I
+got the failure on stage2 phase:
+ "inplace/bin/ghc-stage2" -H32m -O -H64m -O0 -w ...
+ ghc-stage2: internal error: evacuate: strange closure type 15
+ (GHC version 6.12.3 for ia64_unknown_linux)
+ Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug
+ make[1]: *** [libraries/dph/dph-base/dist-install/build/Data/Array/Parallel/Base/Hyperstrict.o] Aborted
+
+I attached gdb and got backtrace:
+
+Breakpoint 1 at 0x400000000469ec31: file rts/RtsMessages.c, line 39.
+(gdb) run -B/var/tmp/portage/dev-lang/ghc-6.12.3/work/ghc-6.12.3/inplace/bin --info
+Starting program: /var/tmp/portage/dev-lang/ghc-6.12.3/work/ghc-6.12.3/inplace/lib/ghc-stage2 -B/var/tmp/portage/dev-lang/ghc-6.12.3/work/ghc-6.12.3/inplace/bin --info
+[Thread debugging using libthread_db enabled]
+
+Breakpoint 1, barf (s=0x40000000047915b0 "evacuate: strange closure type %d") at rts/RtsMessages.c:39
+39 va_start(ap,s);
+(gdb) bt
+#0 barf (s=0x40000000047915b0 "evacuate: strange closure type %d") at rts/RtsMessages.c:39
+#1 0x400000000474a1e0 in evacuate (p=0x6000000000147958) at rts/sm/Evac.c:756
+#2 0x40000000046d68c0 in scavenge_srt (srt=0x6000000000147958, srt_bitmap=7) at rts/sm/Scav.c:348
+...
+
+> 16:52:53 < zygoloid> slyfox: i'm no ghc expert but it looks like HEAP_ALLOCED_GC(q)
+> is returning true for a FUN_STATIC closure
+> 17:18:43 < zygoloid> try: p HEAP_ALLOCED_miss((unsigned long)(*p) >> 20, *p)
+> 17:19:12 < slyfox> (gdb) p HEAP_ALLOCED_miss((unsigned long)(*p) >> 20, *p)
+> 17:19:12 < slyfox> $1 = 0
+> 17:19:40 < zygoloid> i /think/ that means the mblock_cache is broken
+> 17:22:45 < zygoloid> i can't help further. however i am suspicious that you seem to have pointers with similar-looking low 33
+> bits and different high 4 bits, and it looks like such pointers get put into the same bucket in
+> mblock_cache.
+...
+> 17:36:16 < zygoloid> slyfox: try changing the definition of MbcCacheLine to StgWord64, see if that helps
+> 17:36:31 < zygoloid> that's in includes/rts/storage/MBlock.h
+And it helped!
+
+diff --git a/includes/rts/storage/MBlock.h b/includes/rts/storage/MBlock.h
+index 0943d4c..a113498 100644
+--- a/includes/rts/storage/MBlock.h
++++ b/includes/rts/storage/MBlock.h
+@@ -126,7 +126,17 @@ extern StgWord8 mblock_map[];
+
+ #define MBC_LINE_BITS 0
+ #define MBC_TAG_BITS 15
+-typedef StgWord32 MbcCacheLine; // could use 16, but 32 was faster
++
++#if x86_64_HOST_ARCH
++// 32bits are enough for 'entry' as modern amd64 boxes have
++// only 48bit sized virtual addres.
++typedef StgWord32 MbcCacheLine;
++#else
++// 32bits is not enough here as some arches (like ia64) use
++// upper address bits to distinct memory areas.
++typedef StgWord64 MbcCacheLine;
++#endif
++
+ typedef StgWord8 MBlockMapLine;
+
+ #define MBLOCK_MAP_LINE(p) (((StgWord)p & 0xffffffff) >> (MBLOCK_SHIFT + MBC_LINE_BITS))