libuv: fall back to gcc/clang builtins on arm

This commit is contained in:
Jeremy Drake
2021-01-12 17:37:47 -08:00
parent 1fa3f653a4
commit 4cba116100
2 changed files with 32 additions and 3 deletions

View File

@@ -5,7 +5,7 @@ _realname=libuv
pkgbase=mingw-w64-${_realname}
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=1.40.0
pkgrel=2
pkgrel=3
pkgdesc="Cross-platform asynchronous I/O (mingw-w64)"
arch=('any')
mingw_arch=('mingw32' 'mingw64' 'ucrt64')
@@ -14,11 +14,14 @@ license=("custom")
makedepends=("${MINGW_PACKAGE_PREFIX}-gcc")
depends=("${MINGW_PACKAGE_PREFIX}-gcc-libs")
options=('staticlibs' 'strip')
source=("${_realname}-${pkgver}.tar.gz"::"https://github.com/libuv/libuv/archive/v${pkgver}.tar.gz")
sha256sums=('70fe1c9ba4f2c509e8166c0ca2351000237da573bb6c82092339207a9715ba6b')
source=("${_realname}-${pkgver}.tar.gz"::"https://github.com/libuv/libuv/archive/v${pkgver}.tar.gz"
"libuv-win-atomics-non-x86.patch")
sha256sums=('70fe1c9ba4f2c509e8166c0ca2351000237da573bb6c82092339207a9715ba6b'
'cfdc72694fb8578499eece9cf51102b8cc140d2ab07cd77c1a371b950d2add95')
prepare() {
cd "${srcdir}/${_realname}-${pkgver}"
patch -Np1 -i ../libuv-win-atomics-non-x86.patch
./autogen.sh
}

View File

@@ -0,0 +1,26 @@
--- libuv-1.40.0/src/win/atomicops-inl.h.orig 2021-01-12 14:43:58.259375600 -0800
+++ libuv-1.40.0/src/win/atomicops-inl.h 2021-01-12 14:49:35.587505100 -0800
@@ -41,6 +41,8 @@
#else /* GCC */
+#if defined(__i386__) || defined(__x86_64__)
+
/* Mingw-32 version, hopefully this works for 64-bit gcc as well. */
static inline char uv__atomic_exchange_set(char volatile* target) {
const char one = 1;
@@ -52,6 +54,14 @@
return old_value;
}
+#else
+
+static inline char uv__atomic_exchange_set(char volatile* target) {
+ return __atomic_exchange_n(target, 1, __ATOMIC_SEQ_CST);
+}
+
+#endif
+
#endif
#endif /* UV_WIN_ATOMICOPS_INL_H_ */