[Pkg-haskell-commits] darcs: ghc: Apply a4b1a435 from upstream, to fix building on 64 big endian platforms such as s390x. Thanks to Aurelien Jarno for pointing out the fix. Closes: #740144

Joachim Breitner mail at joachim-breitner.de
Mon Mar 3 08:51:39 UTC 2014


Mon Mar  3 08:12:43 UTC 2014  Joachim Breitner <mail at joachim-breitner.de>
  * Apply a4b1a435 from upstream, to fix building on 64 big endian platforms such as s390x. Thanks to Aurelien Jarno for pointing out the fix. Closes: #740144

    M! ./changelog -28 +1
    A! ./patches/64-bit-big-endian
    M! ./patches/series -2 +2

Mon Mar  3 08:12:43 UTC 2014  Joachim Breitner <mail at joachim-breitner.de>
  * Apply a4b1a435 from upstream, to fix building on 64 big endian platforms such as s390x. Thanks to Aurelien Jarno for pointing out the fix. Closes: #740144
diff -rN -u old-ghc/changelog new-ghc/changelog
--- old-ghc/changelog	2014-03-03 08:51:39.584499526 +0000
+++ new-ghc/changelog	2014-03-03 08:51:39.604499526 +0000
@@ -1,31 +1,4 @@
-ghc (7.8.20140130-4) UNRELEASED; urgency=medium
-
-  * Do not provide stm or parallel, these are not officially part of the GHC
-    distribution.
-
- -- Joachim Breitner <nomeata at debian.org>  Tue, 18 Feb 2014 22:19:10 +0000
-
-ghc (7.8.20140130-3) experimental; urgency=medium
-
-  * transformers now comes with ghc, put it in the Provides line 
-
- -- Joachim Breitner <nomeata at debian.org>  Sun, 09 Feb 2014 20:54:01 +0000
-
-ghc (7.8.20140130-2) experimental; urgency=medium
-
-  * Call ghc and ghc-pkg via the wrappers in /usr/bin in the postinst script
-    (Closes: 738183)
-
- -- Joachim Breitner <nomeata at debian.org>  Sat, 08 Feb 2014 12:28:59 +0000
-
-ghc (7.8.20140130-1) experimental; urgency=low
-
-  * New upstream release candidate
-  * Drop ghc-dynamic, now contained in ghc
-
- -- Joachim Breitner <nomeata at debian.org>  Wed, 05 Feb 2014 10:51:51 +0000
-
-ghc (7.6.3-7) unstable; urgency=low
+ghc (7.6.3-7) UNRELEASED; urgency=low
 
   [ Gianfranco Costamagna ]
   * Bumped standard version to 3.9.5, no changes required.
diff -rN -u old-ghc/patches/64-bit-big-endian new-ghc/patches/64-bit-big-endian
--- old-ghc/patches/64-bit-big-endian	1970-01-01 00:00:00.000000000 +0000
+++ new-ghc/patches/64-bit-big-endian	2014-03-03 08:51:39.604499526 +0000
@@ -0,0 +1,63 @@
+commit a4b1a43542b11d09dd3b603d82c5a0e99da67d74
+Author: Austin Seipp <austin at well-typed.com>
+Date:   Fri Nov 1 22:17:01 2013 -0500
+
+    Fix loop on 64bit Big-Endian platforms (#8134)
+    
+    This is a fun one.
+    
+    In the RTS, `cas` expects a pointer to StgWord which will translate to
+    unsigned long (8 bytes under LP64.) But we had previously declared
+    token_locked as *StgBool* - which evaluates to 'int' (4 bytes under
+    LP64.) That means we fail to provide enough storage for the cas
+    primitive, causing it to corrupt memory on a 64bit platform.
+    
+    Hilariously, this somehow did not affect little-endian platforms (ARM,
+    x86, etc) before. That's because to clear our lock token, we would say:
+    
+        token_locked = 0;
+    
+    But because token_locked is 32bits technically, this only writes to
+    half of the 64bit quantity. On a Big-Endian machine, this won't do
+    anything. That is, token_locked starts as 0:
+    
+     / token_locked
+     |
+     v
+     0x00000000
+    
+    and the first cas modifies the memory to:
+    
+     / valid    / corrupted
+     |          |
+     v          v
+     0x00000000 0x00000001
+    
+    We then clear token_locked, but this doesn't change the corrupted 4
+    bytes of memory. And then we try to lock the token again, spinning until
+    it is released - clearly a deadlock.
+    
+    Related: Windows (amd64) doesn't follow LP64, but LLP64, where both
+    int and long are 4 bytes, so this shouldn't change anything on these
+    platforms.
+    
+    Thanks to Reid Barton for helping the diagnosis. Also, thanks to Jens
+    Peterson who confirmed this also fixes building GHC on Fedora/ppc64 and
+    Fedora/s390x.
+    
+    Authored-by: Gustavo Luiz Duarte <gustavold at linux.vnet.ibm.com>
+    Signed-off-by: Austin Seipp <austin at well-typed.com>
+
+Index: ghc-7.6.3/rts/STM.c
+===================================================================
+--- ghc-7.6.3.orig/rts/STM.c	2014-03-03 09:11:24.714692842 +0100
++++ ghc-7.6.3/rts/STM.c	2014-03-03 09:11:24.714692842 +0100
+@@ -927,7 +927,7 @@
+ static volatile StgInt64 max_commits = 0;
+ 
+ #if defined(THREADED_RTS)
+-static volatile StgBool token_locked = FALSE;
++static volatile StgWord token_locked = FALSE;
+ 
+ static void getTokenBatch(Capability *cap) {
+   while (cas((void *)&token_locked, FALSE, TRUE) == TRUE) { /* nothing */ }
diff -rN -u old-ghc/patches/series new-ghc/patches/series
--- old-ghc/patches/series	2014-03-03 08:51:39.584499526 +0000
+++ new-ghc/patches/series	2014-03-03 08:51:39.604499526 +0000
@@ -1,5 +1,5 @@
 use-debian-gen_contents_index
 ARM-VFPv3D16
 no-missing-haddock-file-warning
-haddock-hardcode-ghc-paths
-hpc-wrapper
+Handle-sign-bit-when-generating-veneer-for-ARM-Thumb.patch
+llvm-3.3-compat




More information about the Pkg-haskell-commits mailing list