diff mbox series

[scarthgap] libdeflate: fix build with -mcpu=cortex-a76+crypto without -march=armv8.2-a+crypto

Message ID 20240529131655.3187405-1-martin.jansa@gmail.com
State New
Headers show
Series [scarthgap] libdeflate: fix build with -mcpu=cortex-a76+crypto without -march=armv8.2-a+crypto | expand

Commit Message

Martin Jansa May 29, 2024, 1:16 p.m. UTC
* fixes:
  https://github.com/ebiggers/libdeflate/issues/369

Signed-off-by: Martin Jansa <martin.jansa@gmail.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 ...e-explicit-armv8.2-a-on-gcc-13.2-and.patch | 57 +++++++++++++++++++
 .../libdeflate/libdeflate_1.20.bb             |  5 +-
 2 files changed, 60 insertions(+), 2 deletions(-)
 create mode 100644 meta-oe/recipes-extended/libdeflate/libdeflate/0001-lib-arm-don-t-use-explicit-armv8.2-a-on-gcc-13.2-and.patch

Comments

akuster808 May 30, 2024, 4:49 p.m. UTC | #1
On 5/29/24 9:16 AM, Martin Jansa via lists.openembedded.org wrote:
> * fixes:
>    https://github.com/ebiggers/libdeflate/issues/369
>
> Signed-off-by: Martin Jansa <martin.jansa@gmail.com>
> Signed-off-by: Khem Raj <raj.khem@gmail.com>

I have this already backported to scarthgap-nut

thanks,
Armin
> ---
>   ...e-explicit-armv8.2-a-on-gcc-13.2-and.patch | 57 +++++++++++++++++++
>   .../libdeflate/libdeflate_1.20.bb             |  5 +-
>   2 files changed, 60 insertions(+), 2 deletions(-)
>   create mode 100644 meta-oe/recipes-extended/libdeflate/libdeflate/0001-lib-arm-don-t-use-explicit-armv8.2-a-on-gcc-13.2-and.patch
>
> diff --git a/meta-oe/recipes-extended/libdeflate/libdeflate/0001-lib-arm-don-t-use-explicit-armv8.2-a-on-gcc-13.2-and.patch b/meta-oe/recipes-extended/libdeflate/libdeflate/0001-lib-arm-don-t-use-explicit-armv8.2-a-on-gcc-13.2-and.patch
> new file mode 100644
> index 0000000000..e87972af27
> --- /dev/null
> +++ b/meta-oe/recipes-extended/libdeflate/libdeflate/0001-lib-arm-don-t-use-explicit-armv8.2-a-on-gcc-13.2-and.patch
> @@ -0,0 +1,57 @@
> +From 684ebc7f8eb44558219d4b5be52add1250b3c0ca Mon Sep 17 00:00:00 2001
> +From: Eric Biggers <ebiggers@google.com>
> +Date: Tue, 30 Apr 2024 11:27:55 -0700
> +Subject: [PATCH] lib/arm: don't use explicit armv8.2-a on gcc 13.2 and later
> +
> +Resolves https://github.com/ebiggers/libdeflate/issues/369
> +---
> +Upstream-Status: Backport [https://github.com/ebiggers/libdeflate/pull/370]
> +
> + lib/arm/adler32_impl.h | 10 ++++++----
> + lib/arm/crc32_impl.h   | 10 ++++++----
> + 2 files changed, 12 insertions(+), 8 deletions(-)
> +
> +diff --git a/lib/arm/adler32_impl.h b/lib/arm/adler32_impl.h
> +index 6453b8e..6144afb 100644
> +--- a/lib/arm/adler32_impl.h
> ++++ b/lib/arm/adler32_impl.h
> +@@ -214,11 +214,13 @@ adler32_arm_neon(u32 adler, const u8 *p, size_t len)
> + #  ifdef __clang__
> + #    define ATTRIBUTES	_target_attribute("dotprod")
> +    /*
> +-    * With gcc, arch=armv8.2-a is needed for dotprod intrinsics, unless the
> +-    * default target is armv8.3-a or later in which case it must be omitted.
> +-    * armv8.3-a or later can be detected by checking for __ARM_FEATURE_JCVT.
> ++    * With gcc 13.1 and earlier (before gcc commit 73d3bc348190 or 9aac37ab8a7b,
> ++    * "aarch64: Remove architecture dependencies from intrinsics"),
> ++    * arch=armv8.2-a is needed for the dotprod intrinsics, unless the default
> ++    * target is armv8.3-a or later in which case it must be omitted.  armv8.3-a
> ++    * or later can be detected by checking for __ARM_FEATURE_JCVT.
> +     */
> +-#  elif defined(__ARM_FEATURE_JCVT)
> ++#  elif GCC_PREREQ(13, 2) || defined(__ARM_FEATURE_JCVT)
> + #    define ATTRIBUTES	_target_attribute("+dotprod")
> + #  else
> + #    define ATTRIBUTES	_target_attribute("arch=armv8.2-a+dotprod")
> +diff --git a/lib/arm/crc32_impl.h b/lib/arm/crc32_impl.h
> +index 3c4bec7..5363041 100644
> +--- a/lib/arm/crc32_impl.h
> ++++ b/lib/arm/crc32_impl.h
> +@@ -551,11 +551,13 @@ crc32_arm_pmullx4(u32 crc, const u8 *p, size_t len)
> + #  ifdef __clang__
> + #    define ATTRIBUTES	_target_attribute("aes,crc,sha3")
> +    /*
> +-    * With gcc, arch=armv8.2-a is needed for the sha3 intrinsics, unless the
> +-    * default target is armv8.3-a or later in which case it must be omitted.
> +-    * armv8.3-a or later can be detected by checking for __ARM_FEATURE_JCVT.
> ++    * With gcc 13.1 and earlier (before gcc commit 73d3bc348190 or 9aac37ab8a7b,
> ++    * "aarch64: Remove architecture dependencies from intrinsics"),
> ++    * arch=armv8.2-a is needed for the sha3 intrinsics, unless the default
> ++    * target is armv8.3-a or later in which case it must be omitted.  armv8.3-a
> ++    * or later can be detected by checking for __ARM_FEATURE_JCVT.
> +     */
> +-#  elif defined(__ARM_FEATURE_JCVT)
> ++#  elif GCC_PREREQ(13, 2) || defined(__ARM_FEATURE_JCVT)
> + #    define ATTRIBUTES	_target_attribute("+crypto,+crc,+sha3")
> + #  else
> + #    define ATTRIBUTES	_target_attribute("arch=armv8.2-a+crypto+crc+sha3")
> diff --git a/meta-oe/recipes-extended/libdeflate/libdeflate_1.20.bb b/meta-oe/recipes-extended/libdeflate/libdeflate_1.20.bb
> index f0a966f2b4..e3de8aca62 100644
> --- a/meta-oe/recipes-extended/libdeflate/libdeflate_1.20.bb
> +++ b/meta-oe/recipes-extended/libdeflate/libdeflate_1.20.bb
> @@ -6,10 +6,11 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=7b6977026437092191e9da699ed9f780"
>   
>   DEPENDS += "gzip zlib"
>   
> -SRC_URI = "git://github.com/ebiggers/libdeflate.git;protocol=https;branch=master"
> +SRC_URI = "git://github.com/ebiggers/libdeflate.git;protocol=https;branch=master \
> +    file://0001-lib-arm-don-t-use-explicit-armv8.2-a-on-gcc-13.2-and.patch \
> +"
>   
>   S = "${WORKDIR}/git"
>   SRCREV = "275aa5141db6eda3587214e0f1d3a134768f557d"
>   
>   inherit cmake pkgconfig
> -
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#110614): https://lists.openembedded.org/g/openembedded-devel/message/110614
> Mute This Topic: https://lists.openembedded.org/mt/106368430/3616698
> Group Owner: openembedded-devel+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub [akuster808@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
diff mbox series

Patch

diff --git a/meta-oe/recipes-extended/libdeflate/libdeflate/0001-lib-arm-don-t-use-explicit-armv8.2-a-on-gcc-13.2-and.patch b/meta-oe/recipes-extended/libdeflate/libdeflate/0001-lib-arm-don-t-use-explicit-armv8.2-a-on-gcc-13.2-and.patch
new file mode 100644
index 0000000000..e87972af27
--- /dev/null
+++ b/meta-oe/recipes-extended/libdeflate/libdeflate/0001-lib-arm-don-t-use-explicit-armv8.2-a-on-gcc-13.2-and.patch
@@ -0,0 +1,57 @@ 
+From 684ebc7f8eb44558219d4b5be52add1250b3c0ca Mon Sep 17 00:00:00 2001
+From: Eric Biggers <ebiggers@google.com>
+Date: Tue, 30 Apr 2024 11:27:55 -0700
+Subject: [PATCH] lib/arm: don't use explicit armv8.2-a on gcc 13.2 and later
+
+Resolves https://github.com/ebiggers/libdeflate/issues/369
+---
+Upstream-Status: Backport [https://github.com/ebiggers/libdeflate/pull/370]
+
+ lib/arm/adler32_impl.h | 10 ++++++----
+ lib/arm/crc32_impl.h   | 10 ++++++----
+ 2 files changed, 12 insertions(+), 8 deletions(-)
+
+diff --git a/lib/arm/adler32_impl.h b/lib/arm/adler32_impl.h
+index 6453b8e..6144afb 100644
+--- a/lib/arm/adler32_impl.h
++++ b/lib/arm/adler32_impl.h
+@@ -214,11 +214,13 @@ adler32_arm_neon(u32 adler, const u8 *p, size_t len)
+ #  ifdef __clang__
+ #    define ATTRIBUTES	_target_attribute("dotprod")
+    /*
+-    * With gcc, arch=armv8.2-a is needed for dotprod intrinsics, unless the
+-    * default target is armv8.3-a or later in which case it must be omitted.
+-    * armv8.3-a or later can be detected by checking for __ARM_FEATURE_JCVT.
++    * With gcc 13.1 and earlier (before gcc commit 73d3bc348190 or 9aac37ab8a7b,
++    * "aarch64: Remove architecture dependencies from intrinsics"),
++    * arch=armv8.2-a is needed for the dotprod intrinsics, unless the default
++    * target is armv8.3-a or later in which case it must be omitted.  armv8.3-a
++    * or later can be detected by checking for __ARM_FEATURE_JCVT.
+     */
+-#  elif defined(__ARM_FEATURE_JCVT)
++#  elif GCC_PREREQ(13, 2) || defined(__ARM_FEATURE_JCVT)
+ #    define ATTRIBUTES	_target_attribute("+dotprod")
+ #  else
+ #    define ATTRIBUTES	_target_attribute("arch=armv8.2-a+dotprod")
+diff --git a/lib/arm/crc32_impl.h b/lib/arm/crc32_impl.h
+index 3c4bec7..5363041 100644
+--- a/lib/arm/crc32_impl.h
++++ b/lib/arm/crc32_impl.h
+@@ -551,11 +551,13 @@ crc32_arm_pmullx4(u32 crc, const u8 *p, size_t len)
+ #  ifdef __clang__
+ #    define ATTRIBUTES	_target_attribute("aes,crc,sha3")
+    /*
+-    * With gcc, arch=armv8.2-a is needed for the sha3 intrinsics, unless the
+-    * default target is armv8.3-a or later in which case it must be omitted.
+-    * armv8.3-a or later can be detected by checking for __ARM_FEATURE_JCVT.
++    * With gcc 13.1 and earlier (before gcc commit 73d3bc348190 or 9aac37ab8a7b,
++    * "aarch64: Remove architecture dependencies from intrinsics"),
++    * arch=armv8.2-a is needed for the sha3 intrinsics, unless the default
++    * target is armv8.3-a or later in which case it must be omitted.  armv8.3-a
++    * or later can be detected by checking for __ARM_FEATURE_JCVT.
+     */
+-#  elif defined(__ARM_FEATURE_JCVT)
++#  elif GCC_PREREQ(13, 2) || defined(__ARM_FEATURE_JCVT)
+ #    define ATTRIBUTES	_target_attribute("+crypto,+crc,+sha3")
+ #  else
+ #    define ATTRIBUTES	_target_attribute("arch=armv8.2-a+crypto+crc+sha3")
diff --git a/meta-oe/recipes-extended/libdeflate/libdeflate_1.20.bb b/meta-oe/recipes-extended/libdeflate/libdeflate_1.20.bb
index f0a966f2b4..e3de8aca62 100644
--- a/meta-oe/recipes-extended/libdeflate/libdeflate_1.20.bb
+++ b/meta-oe/recipes-extended/libdeflate/libdeflate_1.20.bb
@@ -6,10 +6,11 @@  LIC_FILES_CHKSUM = "file://COPYING;md5=7b6977026437092191e9da699ed9f780"
 
 DEPENDS += "gzip zlib"
 
-SRC_URI = "git://github.com/ebiggers/libdeflate.git;protocol=https;branch=master"
+SRC_URI = "git://github.com/ebiggers/libdeflate.git;protocol=https;branch=master \
+    file://0001-lib-arm-don-t-use-explicit-armv8.2-a-on-gcc-13.2-and.patch \
+"
 
 S = "${WORKDIR}/git"
 SRCREV = "275aa5141db6eda3587214e0f1d3a134768f557d"
 
 inherit cmake pkgconfig
-