summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobert Marko <robimarko@gmail.com>2024-04-15 11:03:08 +0200
committerRobert Marko <robimarko@gmail.com>2024-04-15 13:52:37 +0200
commit2116073f981ead48f5fe0af213cbdfe013288fb9 (patch)
treeb52fc13bc9d4c0ec9646f8ada781da144ef0f8ea
parent123282d9f9edf361729c2e8bb410957a6844d845 (diff)
downloadopenwrt-2116073f981ead48f5fe0af213cbdfe013288fb9.tar.gz
openwrt-2116073f981ead48f5fe0af213cbdfe013288fb9.tar.bz2
openwrt-2116073f981ead48f5fe0af213cbdfe013288fb9.zip
tools: libdeflate: backport fix for AVX-VNNI
Trying to compile with new new enough GCC but older binutils that dont support AVX-VNNI will error out on the assembler, so backport an upstream fix for it. Fixes: 338b463e1e97 ("tools: libdeflate: update to 1.20") Signed-off-by: Robert Marko <robimarko@gmail.com>
-rw-r--r--tools/libdeflate/Makefile2
-rw-r--r--tools/libdeflate/patches/0001-lib-x86-increase-AVX-VNNI-gcc-prerequisite-to-12.1.patch32
2 files changed, 33 insertions, 1 deletions
diff --git a/tools/libdeflate/Makefile b/tools/libdeflate/Makefile
index 68f7fb1372..6bf25d134d 100644
--- a/tools/libdeflate/Makefile
+++ b/tools/libdeflate/Makefile
@@ -8,7 +8,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=libdeflate
PKG_VERSION:=1.20
-PKG_RELEASE:=1
+PKG_RELEASE:=2
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://github.com/ebiggers/libdeflate/releases/download/v$(PKG_VERSION)
diff --git a/tools/libdeflate/patches/0001-lib-x86-increase-AVX-VNNI-gcc-prerequisite-to-12.1.patch b/tools/libdeflate/patches/0001-lib-x86-increase-AVX-VNNI-gcc-prerequisite-to-12.1.patch
new file mode 100644
index 0000000000..ea4f4dc4c1
--- /dev/null
+++ b/tools/libdeflate/patches/0001-lib-x86-increase-AVX-VNNI-gcc-prerequisite-to-12.1.patch
@@ -0,0 +1,32 @@
+From e522b1d09d3536ddc15459b4259150f4a53ee65a Mon Sep 17 00:00:00 2001
+From: Eric Biggers <ebiggers@google.com>
+Date: Thu, 4 Apr 2024 20:16:33 -0400
+Subject: [PATCH] lib/x86: increase AVX-VNNI gcc prerequisite to 12.1
+
+Although gcc 11.1 supports AVX-VNNI, a popular distro pairs it with a
+binutils version that does not. Require gcc 12 instead.
+
+Resolves https://github.com/ebiggers/libdeflate/issues/365
+---
+ lib/x86/adler32_impl.h | 9 ++++++++-
+ 1 file changed, 8 insertions(+), 1 deletion(-)
+
+--- a/lib/x86/adler32_impl.h
++++ b/lib/x86/adler32_impl.h
+@@ -52,8 +52,15 @@
+ /*
+ * AVX-VNNI implementation. This is used on CPUs that have AVX2 and AVX-VNNI
+ * but don't have AVX-512, for example Intel Alder Lake.
++ *
++ * Unusually for a new CPU feature, gcc added support for the AVX-VNNI
++ * intrinsics (in gcc 11.1) slightly before binutils added support for
++ * assembling AVX-VNNI instructions (in binutils 2.36). Distros can reasonably
++ * have gcc 11 with binutils 2.35. Because of this issue, we check for gcc 12
++ * instead of gcc 11. (libdeflate supports direct compilation without a
++ * configure step, so checking the binutils version is not always an option.)
+ */
+-#if GCC_PREREQ(11, 1) || CLANG_PREREQ(12, 0, 13000000) || MSVC_PREREQ(1930)
++#if GCC_PREREQ(12, 1) || CLANG_PREREQ(12, 0, 13000000) || MSVC_PREREQ(1930)
+ # define adler32_x86_avx2_vnni adler32_x86_avx2_vnni
+ # define SUFFIX _avx2_vnni
+ # define ATTRIBUTES _target_attribute("avx2,avxvnni")