From: Debian Haskell Group Date: Mon, 19 Feb 2024 16:12:25 +0000 (+0100) Subject: Use native x86_64 instructions on x32 X-Git-Tag: archive/raspbian/9.6.6-2+rpi1~2^2^2^2~22 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=2773b6ece431bee25dc9f878ef587cd8f2e25c2e;p=ghc.git 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 Gbp-Pq: Name x32-use-native-x86_64-insn.patch --- diff --git a/rts/RtsSymbols.c b/rts/RtsSymbols.c index facc4035..ae527255 100644 --- a/rts/RtsSymbols.c +++ b/rts/RtsSymbols.c @@ -935,7 +935,7 @@ extern char **environ; // 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) \