aboutsummaryrefslogtreecommitdiff
path: root/archivers/7-zip/files/patch-C_CpuArch.c
diff options
context:
space:
mode:
Diffstat (limited to 'archivers/7-zip/files/patch-C_CpuArch.c')
-rw-r--r--archivers/7-zip/files/patch-C_CpuArch.c28
1 files changed, 18 insertions, 10 deletions
diff --git a/archivers/7-zip/files/patch-C_CpuArch.c b/archivers/7-zip/files/patch-C_CpuArch.c
index 579b684d4337..f0c8cba0f67c 100644
--- a/archivers/7-zip/files/patch-C_CpuArch.c
+++ b/archivers/7-zip/files/patch-C_CpuArch.c
@@ -1,30 +1,38 @@
---- C/CpuArch.c.orig 2021-12-12 14:45:15 UTC
+--- C/CpuArch.c.orig 2023-08-31 09:13:13 UTC
+++ C/CpuArch.c
-@@ -417,6 +417,23 @@ BoolInt CPU_IsSupported_AES (void) { return APPLE_CRYP
+@@ -762,6 +762,31 @@ BoolInt CPU_IsSupported_AES (void) { return APPLE_CRYP
#include <sys/auxv.h>
+#if defined(__FreeBSD__)
-+static UInt64 get_hwcap() {
++static unsigned long get_hwcap(int aux) {
+ unsigned long hwcap;
-+ if(elf_aux_info(AT_HWCAP, &hwcap, sizeof(unsigned long)) != 0) {
-+ return(0);
++ if (elf_aux_info(aux, &hwcap, sizeof hwcap) != 0) {
++ return 0;
+ }
+ return hwcap;
+}
+
-+BoolInt CPU_IsSupported_CRC32(void) { return get_hwcap() & HWCAP_CRC32; }
++#ifdef MY_CPU_ARM64
++BoolInt CPU_IsSupported_CRC32(void) { return get_hwcap(AT_HWCAP) & HWCAP_CRC32; }
+BoolInt CPU_IsSupported_NEON(void) { return 1; }
-+BoolInt CPU_IsSupported_SHA1(void){ return get_hwcap() & HWCAP_SHA1; }
-+BoolInt CPU_IsSupported_SHA2(void) { return get_hwcap() & HWCAP_SHA2; }
-+BoolInt CPU_IsSupported_AES(void) { return get_hwcap() & HWCAP_AES; }
++BoolInt CPU_IsSupported_SHA1(void){ return get_hwcap(AT_HWCAP) & HWCAP_SHA1; }
++BoolInt CPU_IsSupported_SHA2(void) { return get_hwcap(AT_HWCAP) & HWCAP_SHA2; }
++BoolInt CPU_IsSupported_AES(void) { return get_hwcap(AT_HWCAP) & HWCAP_AES; }
++#else /* MY_CPU_ARM */
++BoolInt CPU_IsSupported_CRC32(void) { return get_hwcap(AT_HWCAP2) & HWCAP2_CRC32; }
++BoolInt CPU_IsSupported_NEON(void) { return get_hwcap(AT_HWCAP) & HWCAP_NEON; }
++BoolInt CPU_IsSupported_SHA1(void){ return get_hwcap(AT_HWCAP2) & HWCAP2_SHA1; }
++BoolInt CPU_IsSupported_SHA2(void) { return get_hwcap(AT_HWCAP2) & HWCAP2_SHA2; }
++BoolInt CPU_IsSupported_AES(void) { return get_hwcap(AT_HWCAP2) & HWCAP2_AES; }
++#endif
+
+#else // __FreeBSD__
+
#define USE_HWCAP
#ifdef USE_HWCAP
-@@ -450,6 +467,7 @@ MY_HWCAP_CHECK_FUNC (SHA1)
+@@ -795,6 +820,7 @@ MY_HWCAP_CHECK_FUNC (SHA1)
MY_HWCAP_CHECK_FUNC (SHA2)
MY_HWCAP_CHECK_FUNC (AES)