Skip to contentSkip to conversation

minifi-cpp: Fix libsodium build on aarch64/clang

PATCH New Khem Raj 1 participant 1 message Mar 27, 2024

lore
Share & tools
lore

Khem Raj

author
#0 lore raw

PATCH 1/1 minifi-cpp: Fix libsodium build on aarch64/clang

---
 .../files/0008-libsodium-aarch64_crypto.patch | 38 +++++++++++++++++++
 .../minifi-cpp/minifi-cpp_0.15.0.bb           |  1 +
 2 files changed, 39 insertions(+)
 create mode 100644 meta-oe/recipes-extended/minifi-cpp/files/0008-libsodium-aarch64_crypto.patch
meta-oe/recipes-extended/minifi-cpp/files/0008-libsodium-aarch64_crypto.patch new file +38 -0
new file mode 100644
index 0000000000..c2c51148f6
@@ -0,0 +1,38 @@
+Move target #pragma after arm_neon.h include
+
+Fix per android/ndk#1945
+
+If the pragma is done before the header include,
+when using clang compiler attribute may apply to the functions in arm_neon.h
+
+Upstream-Status: Submitted [https://github.com/jedisct1/libsodium/pull/1321]
+
+Signed-off-by: Khem Raj <[email protected]>
+--- a/thirdparty/libsodium-stable/src/libsodium/crypto_aead/aes256gcm/armcrypto/aead_aes256gcm_armcrypto.c
++++ b/thirdparty/libsodium-stable/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 <arm_neon.h>
+ 
++#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
meta-oe/recipes-extended/minifi-cpp/minifi-cpp_0.15.0.bb +1 -0
index 0667fdaecf..beb247c254 100644
@@ -26,6 +26,7 @@ SRC_URI = "git://github.com/apache/nifi-minifi-cpp.git;protocol=https;branch=mai
            file://0005-Pass-noline-flag-to-flex.patch \
            file://0006-OsUtils.h-add-missing-header-cstdint-for-int64_t.patch \
            file://0007-CMakeLists.txt-do-not-use-ccache.patch \
+           file://0008-libsodium-aarch64_crypto.patch \
            file://systemd-volatile.conf \
            file://sysvinit-volatile.conf \
           "
Signature · 1 line
2.44.0