summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIlias Tsitsimpis <iliastsi@debian.org>2020-03-01 16:25:13 +0200
committerMarge Bot <ben+marge-bot@smart-cactus.org>2020-03-02 01:19:12 -0500
commitdbea7e9d4d4a8812f3dbeed720fb6aa97e16f896 (patch)
tree779f766ecb27d1eefbe2121f8cf8b9c8a8f35266
parent3cf7303bf39bca734bd87f0f42872f1a4025fa34 (diff)
downloadhaskell-dbea7e9d4d4a8812f3dbeed720fb6aa97e16f896.tar.gz
Do not define hs_atomic{read,write}64() on non-64bit
Do not define hs_atomicread64() and hs_atomicwrite64() on machines where WORD_SIZE_IN_BITS is less than 64, just like we do with the rest of the atomic functions which work on 64-bit values. Without this, compilation fails on MIPSel and PowerPC with the following error: /usr/bin/ld: /<<PKGBUILDDIR>>/libraries/ghc-prim/dist-install/build/libHSghc-prim-0.5.3_p.a(atomic.p_o): in function `hs_atomicread64': atomic.c:(.text.hs_atomicread64+0x8): undefined reference to `__sync_add_and_fetch_8' /usr/bin/ld: /<<PKGBUILDDIR>>/libraries/ghc-prim/dist-install/build/libHSghc-prim-0.5.3_p.a(atomic.p_o): in function `hs_atomicwrite64': atomic.c:(.text.hs_atomicwrite64+0x38): undefined reference to `__sync_bool_compare_and_swap_8' Fixes #17886.
-rw-r--r--libraries/ghc-prim/cbits/atomic.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/libraries/ghc-prim/cbits/atomic.c b/libraries/ghc-prim/cbits/atomic.c
index ac2e608ec2..01037d70ee 100644
--- a/libraries/ghc-prim/cbits/atomic.c
+++ b/libraries/ghc-prim/cbits/atomic.c
@@ -361,6 +361,7 @@ hs_atomicread32(StgWord x)
#endif
}
+#if WORD_SIZE_IN_BITS == 64
extern StgWord64 hs_atomicread64(StgWord x);
StgWord64
hs_atomicread64(StgWord x)
@@ -371,6 +372,7 @@ hs_atomicread64(StgWord x)
return __sync_add_and_fetch((StgWord64 *) x, 0);
#endif
}
+#endif
// AtomicWriteByteArrayOp_Int
// Implies a full memory barrier (see compiler/prelude/primops.txt.pp)
@@ -409,6 +411,7 @@ hs_atomicwrite32(StgWord x, StgWord val)
#endif
}
+#if WORD_SIZE_IN_BITS == 64
extern void hs_atomicwrite64(StgWord x, StgWord64 val);
void
hs_atomicwrite64(StgWord x, StgWord64 val)
@@ -420,3 +423,5 @@ hs_atomicwrite64(StgWord x, StgWord64 val)
#endif
}
#endif
+
+#endif