Hi!

Attaching a refined patch with more fine-grained x32 detection and
updated for ghc 8.0.1.

Could you please apply it so we can enable ghc on the buildds for x32
again?

Thanks,
Adrian

-- 
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer - glaub...@debian.org
`. `'   Freie Universitaet Berlin - glaub...@physik.fu-berlin.de
  `-    GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913
diff -Nru old/ghc-8.0.1/debian/patches/series new/ghc-8.0.1/debian/patches/series
--- old/ghc-8.0.1/debian/patches/series	2016-11-01 16:05:20.000000000 +0100
+++ new/ghc-8.0.1/debian/patches/series	2016-11-05 06:25:08.308319129 +0100
@@ -10,3 +10,4 @@
 no-pie
 find-tycon-panic
 compiler-cmm-PprC-sparc-alignment.patch
+x32-use-native-x86_64-insn.patch
diff -Nru old/ghc-8.0.1/debian/patches/x32-use-native-x86_64-insn.patch new/ghc-8.0.1/debian/patches/x32-use-native-x86_64-insn.patch
--- old/ghc-8.0.1/debian/patches/x32-use-native-x86_64-insn.patch	1970-01-01 01:00:00.000000000 +0100
+++ new/ghc-8.0.1/debian/patches/x32-use-native-x86_64-insn.patch	2016-11-05 06:26:05.760389006 +0100
@@ -0,0 +1,25 @@
+Description: Use native x86_64 instructions on x32
+ This patch enables a few native 64-bit integer instructions
+ on x32 which are available on this architecture despite using
+ 32-bit pointers. These instructions are present on x86_64 but
+ not on x86 and ghc checks the size of (void *) to determine
+ that. This method fails on x32 since despite using 32-bit
+ pointers and hence sizeof(void *) == 4, it still uses the
+ full x86_64 instruction set and software-emulated variants
+ of the aforementioned 64-bit integer instructions are
+ therefore not present in the toolchain which will make ghc
+ fail to build on x32.
+ See: https://ghc.haskell.org/trac/ghc/ticket/11571
+ .
+
+--- ghc-8.0.1.orig/rts/RtsSymbols.c
++++ ghc-8.0.1/rts/RtsSymbols.c
+@@ -737,7 +737,7 @@
+ 
+ 
+ // 64-bit support functions in libgcc.a
+-#if defined(__GNUC__) && SIZEOF_VOID_P <= 4 && !defined(_ABIN32)
++#if defined(__GNUC__) && SIZEOF_VOID_P <= 4 && !defined(_ABIN32) && !(defined(__x86_64__) && defined(__ILP32__))
+ #define RTS_LIBGCC_SYMBOLS                             \
+       SymI_NeedsProto(__divdi3)                        \
+       SymI_NeedsProto(__udivdi3)                       \
diff -Nru old/ghc-8.0.1/debian/rules new/ghc-8.0.1/debian/rules
--- old/ghc-8.0.1/debian/rules	2016-11-01 16:10:01.000000000 +0100
+++ new/ghc-8.0.1/debian/rules	2016-11-05 06:24:36.720280326 +0100
@@ -38,6 +38,10 @@
 BUILD_HADDOCK_DOCS=YES
 DEB_HOOGLE_TXT_DIR = /usr/lib/ghc-doc/hoogle/
 
+ifeq (x32,$(DEB_HOST_ARCH))
+  EXTRA_CONFIGURE_FLAGS += --enable-unregisterised
+endif
+
 %:
 	dh $@ --with autotools-dev
 

Reply via email to