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