6bf3b9f
Description: Use native x86_64 instructions on x32
6bf3b9f
 This patch enables a few native 64-bit integer instructions
6bf3b9f
 on x32 which are available on this architecture despite using
6bf3b9f
 32-bit pointers. These instructions are present on x86_64 but
6bf3b9f
 not on x86 and ghc checks the size of (void *) to determine
6bf3b9f
 that. This method fails on x32 since despite using 32-bit
6bf3b9f
 pointers and hence sizeof(void *) == 4, it still uses the
6bf3b9f
 full x86_64 instruction set and software-emulated variants
6bf3b9f
 of the aforementioned 64-bit integer instructions are
6bf3b9f
 therefore not present in the toolchain which will make ghc
6bf3b9f
 fail to build on x32.
6bf3b9f
 See: https://ghc.haskell.org/trac/ghc/ticket/11571
6bf3b9f
 .
6bf3b9f
6bf3b9f
Index: ghc-8.0.2/rts/RtsSymbols.c
6bf3b9f
===================================================================
6bf3b9f
--- ghc-8.0.2.orig/rts/RtsSymbols.c
6bf3b9f
+++ ghc-8.0.2/rts/RtsSymbols.c
6bf3b9f
@@ -857,7 +857,7 @@
6bf3b9f
 
6bf3b9f
 
6bf3b9f
 // 64-bit support functions in libgcc.a
6bf3b9f
-#if defined(__GNUC__) && SIZEOF_VOID_P <= 4 && !defined(_ABIN32)
6bf3b9f
+#if defined(__GNUC__) && SIZEOF_VOID_P <= 4 && !defined(_ABIN32) && !(defined(__x86_64__) && defined(__ILP32__))
6bf3b9f
 #define RTS_LIBGCC_SYMBOLS                             \
6bf3b9f
       SymI_NeedsProto(__divdi3)                        \
6bf3b9f
       SymI_NeedsProto(__udivdi3)                       \