diff --git a/0001-Backport-fix-aarch64-Move-target-pragma-after-arm_neon.h_incl.patch b/0001-Backport-fix-aarch64-Move-target-pragma-after-arm_neon.h_incl.patch new file mode 100644 index 0000000000000000000000000000000000000000..693fbdf820d6fc60cb871df29996d06bf7396cc9 --- /dev/null +++ b/0001-Backport-fix-aarch64-Move-target-pragma-after-arm_neon.h_incl.patch @@ -0,0 +1,43 @@ +From 339a30510482d90bdbf031487b8f2a3256bd88d6 Mon Sep 17 00:00:00 2001 +From: tux3 +Date: Mon, 16 Oct 2023 16:42:04 +0200 +Subject: [PATCH] fix(aarch64): Move target #pragma after arm_neon.h include + +Fix per https://github.com/android/ndk/issues/1945 + +If the pragma is done before the header include, +in NDK 26 the attribute may apply to the function in arm_neon.h +--- + .../aes256gcm/armcrypto/aead_aes256gcm_armcrypto.c | 12 ++++++------ + 1 file change, 6 insertions(+), 6 deletions(-) + +diff --git a/src/libsodium/crypto_aead/aes256gcm/armcrypto/aead_aes256gcm_armcrypto.c b/src/libsodium/crypto_aead/aes256gcm/armcrypto/aead_aes256gcm_armcrypto.c +index ed2af303c3..8f9bba6d74 100644 +--- a/src/libsodium/crypto_aead/aes256gcm/armcrypto/aead_aes256gcm_armcrypto.c ++++ b/src/libsodium/crypto_aead/aes256gcm/armcrypto/aead_aes256gcm_armcrypto.c +@@ -19,12 +19,6 @@ + #define __vectorcall + #endif + +-#ifdef __clang__ +-#pragma clang attribute push(__attribute__((target("neon,crypto,aes"))), apply_to = function) +-#elif defined(__GNUC__) +-#pragma GCC target("+simd+crypto") +-#endif +- + #ifndef __ARM_FEATURE_CRYPTO + #define __ARM_FEATURE_CRYPTO 1 + #endif +@@ -34,6 +28,12 @@ + + #include + ++#ifdef __clang__ ++#pragma clang attribute push(__attribute__((target("neon,crypto,aes"))), apply_to = function) ++#elif defined(__GNUC__) ++#pragma GCC target("+simd+crypto") ++#endif ++ + #define ABYTES crypto_aead_aes256gcm_ABYTES + #define NPUBBYTES crypto_aead_aes256gcm_NPUBBYTES + #define KEYBYTES crypto_aead_aes256gcm_KEYBYTES diff --git a/libsodium.spec b/libsodium.spec index acb1416e7ea691c09e8df00ad578a30925e52995..326ccc9b374a248d522e25e321dceb63e5af23f0 100644 --- a/libsodium.spec +++ b/libsodium.spec @@ -1,11 +1,13 @@ Name: libsodium Summary: The Sodium crypto library Version: 1.0.19 -Release: 1 +Release: 2 License: ISC URL: https://github.com/jedisct1/libsodium Source0: %{url}/archive/%{version}/%{name}-%{version}.tar.gz +Patch1: 0001-Backport-fix-aarch64-Move-target-pragma-after-arm_neon.h_incl.patch + BuildRequires: gcc Obsoletes: libsodium23 <= %{version} @@ -54,6 +56,9 @@ make check %exclude %{_libdir}/libsodium.la %changelog +* Tue Nov 5 2024 liaozhiyu - 1.0.19-2 +- backport to support clang aarch64 build + * Tue Oct 17 2023 yaoxin - 1.0.19-1 - Upgrade to 1.0.19