This is exactly the same memcpy()-in-hot-path xxHash problem, see
community/xxhash commit log for details.
The bug makes "lz4 -1" or "lz4 -t" twice slower on x86_64 however
"lz4 -9" is barely affected (do not use "lz4 -b" for benchmarking
this change since it does not calculate the checksum).
Other aport changes:
- use short and fast "make check" (unlike extensive "make test")
for pre-v7 ARM architectures.
---
main/lz4/APKBUILD | 18 ++++++++++--------
...ift-XXH_FORCE_MEMORY_ACCESS-condition.patch | 12 ++++++++++++
2 files changed, 22 insertions(+), 8 deletions(-)
create mode 100644 main/lz4/lift-XXH_FORCE_MEMORY_ACCESS-condition.patch
diff --git a/main/lz4/APKBUILD b/main/lz4/APKBUILD
index a7d5272c60..286998da04 100644
--- a/main/lz4/APKBUILD
+++ b/main/lz4/APKBUILD
@@ -2,20 +2,18 @@
# Maintainer: Stuart Cardall <developer@it-offshore.co.uk>
pkgname=lz4
pkgver=1.8.3
-pkgrel=0
+pkgrel=1
pkgdesc="LZ4 is lossless compression algorithm with fast decoder @ multiple GB/s per core."
url="https://github.com/lz4/lz4"
arch="all"
license="BSD-2-Clause GPL-2.0-only"
checkdepends="diffutils"
subpackages="$pkgname-dev $pkgname-doc $pkgname-libs $pkgname-tests:tests"
-source="$pkgname-$pkgver.tar.gz::https://github.com/$pkgname/$pkgname/archive/v$pkgver.tar.gz"
+source="$pkgname-$pkgver.tar.gz::https://github.com/$pkgname/$pkgname/archive/v$pkgver.tar.gz
+ lift-XXH_FORCE_MEMORY_ACCESS-condition.patch
+ "
builddir="$srcdir"/$pkgname-$pkgver
-case "$CARCH" in
-armhf) options="!check" ;; # FIXME
-esac
-
build() {
cd "$builddir"
make PREFIX="/usr"
@@ -23,7 +21,10 @@ build() {
check() {
cd "$builddir"
- make test
+ case "$CARCH" in
+ armel|armhf) make check;;
+ *) make test;;
+ esac
}
tests() {
@@ -38,4 +39,5 @@ package() {
make PREFIX="/usr" DESTDIR="$pkgdir" install
}
-sha512sums="5d284f75a0c4ad11ebc4abb4394d98c863436da0718d62f648ef2e2cda8e5adf47617a4b43594375f7b0b673541a9ccfaf73880a55fd240986594558214dbf9f lz4-1.8.3.tar.gz"
+sha512sums="5d284f75a0c4ad11ebc4abb4394d98c863436da0718d62f648ef2e2cda8e5adf47617a4b43594375f7b0b673541a9ccfaf73880a55fd240986594558214dbf9f lz4-1.8.3.tar.gz
+9db6af6ed979782ded4794c6a4df20ab1397004d2ad5a09784b2ae4d70ed1d76c9f3417c01a4f4eb3c6ca54fb2363bf18a69a9e75012a5f0e7214fada071d4a0 lift-XXH_FORCE_MEMORY_ACCESS-condition.patch"
diff --git a/main/lz4/lift-XXH_FORCE_MEMORY_ACCESS-condition.patch b/main/lz4/lift-XXH_FORCE_MEMORY_ACCESS-condition.patch
new file mode 100644
index 0000000000..e83640bb1e
--- /dev/null
+++ b/main/lz4/lift-XXH_FORCE_MEMORY_ACCESS-condition.patch
@@ -0,0 +1,12 @@
+--- a/lib/xxhash.c
++++ b/lib/xxhash.c
+@@ -52,8 +52,7 @@
+ #ifndef XXH_FORCE_MEMORY_ACCESS /* can be defined externally, on command line for example */
+ # if defined(__GNUC__) && ( defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) || defined(__ARM_ARCH_6K__) || defined(__ARM_ARCH_6Z__) || defined(__ARM_ARCH_6ZK__) || defined(__ARM_ARCH_6T2__) )
+ # define XXH_FORCE_MEMORY_ACCESS 2
+-# elif (defined(__INTEL_COMPILER) && !defined(_WIN32)) || \
+- (defined(__GNUC__) && ( defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__) || defined(__ARM_ARCH_7R__) || defined(__ARM_ARCH_7M__) || defined(__ARM_ARCH_7S__) ))
++# elif (defined(__INTEL_COMPILER) && !defined(_WIN32)) || defined(__GNUC__)
+ # define XXH_FORCE_MEMORY_ACCESS 1
+ # endif
+ #endif
--
2.19.2
---
Unsubscribe: alpine-aports+unsubscribe@lists.alpinelinux.org
Help: alpine-aports+help@lists.alpinelinux.org
---