From a89df4ebb24293c2d809df91d48ea45fc7bfc376 Mon Sep 17 00:00:00 2001 From: Ben Kimock Date: Thu, 3 Oct 2024 23:53:37 -0400 Subject: [PATCH] Add linkage attributes to extern "C" blocks --- src/ffi_avx2.rs | 4 ++++ src/ffi_avx512.rs | 4 ++++ src/ffi_neon.rs | 4 ++++ src/ffi_sse2.rs | 4 ++++ src/ffi_sse41.rs | 4 ++++ 5 files changed, 20 insertions(+) diff --git a/src/ffi_avx2.rs b/src/ffi_avx2.rs index 33961e9d4..9189c9b50 100644 --- a/src/ffi_avx2.rs +++ b/src/ffi_avx2.rs @@ -33,6 +33,10 @@ pub unsafe fn hash_many( } pub mod ffi { + #[cfg_attr( + not(feature = "prefer_intrinsics"), + link(name = "blake3_sse2_sse41_avx2_assembly", kind = "static") + )] extern "C" { pub fn blake3_hash_many_avx2( inputs: *const *const u8, diff --git a/src/ffi_avx512.rs b/src/ffi_avx512.rs index 884f48135..6d3b235fd 100644 --- a/src/ffi_avx512.rs +++ b/src/ffi_avx512.rs @@ -61,6 +61,10 @@ pub unsafe fn hash_many( } pub mod ffi { + #[cfg_attr( + not(feature = "prefer_intrinsics"), + link(name = "blake3_avx512_assembly", kind = "static") + )] extern "C" { pub fn blake3_compress_in_place_avx512( cv: *mut u32, diff --git a/src/ffi_neon.rs b/src/ffi_neon.rs index 54d07a4de..3a6bab97d 100644 --- a/src/ffi_neon.rs +++ b/src/ffi_neon.rs @@ -53,6 +53,10 @@ pub extern "C" fn blake3_compress_in_place_portable( } pub mod ffi { + #[cfg_attr( + not(feature = "prefer_intrinsics"), + link(name = "blake3_neon", kind = "static") + )] extern "C" { pub fn blake3_hash_many_neon( inputs: *const *const u8, diff --git a/src/ffi_sse2.rs b/src/ffi_sse2.rs index 1c5da81f9..12252b149 100644 --- a/src/ffi_sse2.rs +++ b/src/ffi_sse2.rs @@ -61,6 +61,10 @@ pub unsafe fn hash_many( } pub mod ffi { + #[cfg_attr( + not(feature = "prefer_intrinsics"), + link(name = "blake3_sse2_sse41_avx2_assembly", kind = "static") + )] extern "C" { pub fn blake3_compress_in_place_sse2( cv: *mut u32, diff --git a/src/ffi_sse41.rs b/src/ffi_sse41.rs index 62989c5ec..cfd63df2d 100644 --- a/src/ffi_sse41.rs +++ b/src/ffi_sse41.rs @@ -61,6 +61,10 @@ pub unsafe fn hash_many( } pub mod ffi { + #[cfg_attr( + not(feature = "prefer_intrinsics"), + link(name = "blake3_sse2_sse41_avx2_assembly", kind = "static") + )] extern "C" { pub fn blake3_compress_in_place_sse41( cv: *mut u32,