Control: tags -1 +patch Hi!
The attached patch fixes the issue for me. The underlying problem is the use of legacy atomic functions for which no 64-bit variants exist on some architectures [1]. See also the upstream discussion here [2]. While this patch fixes the original problem, the stage2 build later fails due to memory exhaustion for which I haven't found a solution yet. Thanks, Adrian > [1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63368 > [2] https://gitlab.haskell.org/ghc/ghc/-/issues/23974 -- .''`. John Paul Adrian Glaubitz : :' : Debian Developer `. `' Physicist `- GPG: 62FF 8A75 84E0 2956 9546 0006 7426 3B37 F5B5 F913
Index: ghc-9.4.6/libraries/ghc-prim/cbits/atomic.c =================================================================== --- ghc-9.4.6.orig/libraries/ghc-prim/cbits/atomic.c +++ ghc-9.4.6/libraries/ghc-prim/cbits/atomic.c @@ -291,28 +291,28 @@ extern StgWord hs_cmpxchg8(StgWord x, St StgWord hs_cmpxchg8(StgWord x, StgWord old, StgWord new) { - return __sync_val_compare_and_swap((volatile StgWord8 *) x, (StgWord8) old, (StgWord8) new); + return __atomic_compare_exchange((volatile StgWord8 *) x, (StgWord8 *) &old, (StgWord8 *) &new, false, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST); } extern StgWord hs_cmpxchg16(StgWord x, StgWord old, StgWord new); StgWord hs_cmpxchg16(StgWord x, StgWord old, StgWord new) { - return __sync_val_compare_and_swap((volatile StgWord16 *) x, (StgWord16) old, (StgWord16) new); + return __atomic_compare_exchange((volatile StgWord16 *) x, (StgWord16 *) &old, (StgWord16 *) &new, false, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST); } extern StgWord hs_cmpxchg32(StgWord x, StgWord old, StgWord new); StgWord hs_cmpxchg32(StgWord x, StgWord old, StgWord new) { - return __sync_val_compare_and_swap((volatile StgWord32 *) x, (StgWord32) old, (StgWord32) new); + return __atomic_compare_exchange((volatile StgWord32 *) x, (StgWord32 *) &old, (StgWord32 *) &new, false, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST); } extern StgWord hs_cmpxchg64(StgWord x, StgWord64 old, StgWord64 new); StgWord hs_cmpxchg64(StgWord x, StgWord64 old, StgWord64 new) { - return __sync_val_compare_and_swap((volatile StgWord64 *) x, old, new); + return __atomic_compare_exchange((volatile StgWord64 *) x, (StgWord64 *) &old, (StgWord64 *) &new, false, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST); } // Atomic exchange operations