Skip to content

Commit

Permalink
Add linkage attributes to extern "C" blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
saethlin committed Oct 4, 2024
1 parent 27cbd6b commit a89df4e
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/ffi_avx2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ pub unsafe fn hash_many<const N: usize>(
}

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,
Expand Down
4 changes: 4 additions & 0 deletions src/ffi_avx512.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ pub unsafe fn hash_many<const N: usize>(
}

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,
Expand Down
4 changes: 4 additions & 0 deletions src/ffi_neon.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 4 additions & 0 deletions src/ffi_sse2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ pub unsafe fn hash_many<const N: usize>(
}

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,
Expand Down
4 changes: 4 additions & 0 deletions src/ffi_sse41.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ pub unsafe fn hash_many<const N: usize>(
}

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,
Expand Down

0 comments on commit a89df4e

Please sign in to comment.