Skip to content

Commit a89df4e

Browse files
committed
Add linkage attributes to extern "C" blocks
1 parent 27cbd6b commit a89df4e

File tree

5 files changed

+20
-0
lines changed

5 files changed

+20
-0
lines changed

src/ffi_avx2.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@ pub unsafe fn hash_many<const N: usize>(
3333
}
3434

3535
pub mod ffi {
36+
#[cfg_attr(
37+
not(feature = "prefer_intrinsics"),
38+
link(name = "blake3_sse2_sse41_avx2_assembly", kind = "static")
39+
)]
3640
extern "C" {
3741
pub fn blake3_hash_many_avx2(
3842
inputs: *const *const u8,

src/ffi_avx512.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,10 @@ pub unsafe fn hash_many<const N: usize>(
6161
}
6262

6363
pub mod ffi {
64+
#[cfg_attr(
65+
not(feature = "prefer_intrinsics"),
66+
link(name = "blake3_avx512_assembly", kind = "static")
67+
)]
6468
extern "C" {
6569
pub fn blake3_compress_in_place_avx512(
6670
cv: *mut u32,

src/ffi_neon.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,10 @@ pub extern "C" fn blake3_compress_in_place_portable(
5353
}
5454

5555
pub mod ffi {
56+
#[cfg_attr(
57+
not(feature = "prefer_intrinsics"),
58+
link(name = "blake3_neon", kind = "static")
59+
)]
5660
extern "C" {
5761
pub fn blake3_hash_many_neon(
5862
inputs: *const *const u8,

src/ffi_sse2.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,10 @@ pub unsafe fn hash_many<const N: usize>(
6161
}
6262

6363
pub mod ffi {
64+
#[cfg_attr(
65+
not(feature = "prefer_intrinsics"),
66+
link(name = "blake3_sse2_sse41_avx2_assembly", kind = "static")
67+
)]
6468
extern "C" {
6569
pub fn blake3_compress_in_place_sse2(
6670
cv: *mut u32,

src/ffi_sse41.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,10 @@ pub unsafe fn hash_many<const N: usize>(
6161
}
6262

6363
pub mod ffi {
64+
#[cfg_attr(
65+
not(feature = "prefer_intrinsics"),
66+
link(name = "blake3_sse2_sse41_avx2_assembly", kind = "static")
67+
)]
6468
extern "C" {
6569
pub fn blake3_compress_in_place_sse41(
6670
cv: *mut u32,

0 commit comments

Comments
 (0)