Skip to content

Commit

Permalink
Merge pull request #5 from n0-computer/flub/aarch64-linux-symbol-coll…
Browse files Browse the repository at this point in the history
…isions

fix: avoid more symbol collisions
  • Loading branch information
flub authored Apr 23, 2024
2 parents c94bc3e + 21d060f commit 77aaf09
Show file tree
Hide file tree
Showing 9 changed files with 20 additions and 21 deletions.
4 changes: 2 additions & 2 deletions c/blake3_avx2.c
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ void iroh_blake3_hash_many_sse41(const uint8_t *const *inputs, size_t num_inputs
uint8_t flags, uint8_t flags_start,
uint8_t flags_end, uint8_t *out);
#else
void blake3_hash_many_portable(const uint8_t *const *inputs, size_t num_inputs,
void iroh_blake3_hash_many_portable(const uint8_t *const *inputs, size_t num_inputs,
size_t blocks, const uint32_t key[8],
uint64_t counter, bool increment_counter,
uint8_t flags, uint8_t flags_start,
Expand All @@ -319,7 +319,7 @@ void iroh_blake3_hash_many_avx2(const uint8_t *const *inputs, size_t num_inputs,
iroh_blake3_hash_many_sse41(inputs, num_inputs, blocks, key, counter,
increment_counter, flags, flags_start, flags_end, out);
#else
blake3_hash_many_portable(inputs, num_inputs, blocks, key, counter,
iroh_blake3_hash_many_portable(inputs, num_inputs, blocks, key, counter,
increment_counter, flags, flags_start, flags_end,
out);
#endif
Expand Down
4 changes: 2 additions & 2 deletions c/blake3_c_rust_bindings/benches/bench.rs
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ fn bench_many_chunks_neon(b: &mut Bencher) {
// When "neon" is on, NEON support is assumed.
bench_many_chunks_fn(
b,
blake3_c_rust_bindings::ffi::neon::blake3_hash_many_neon,
blake3_c_rust_bindings::ffi::neon::iroh_blake3_hash_many_neon,
4,
);
}
Expand Down Expand Up @@ -295,7 +295,7 @@ fn bench_many_parents_neon(b: &mut Bencher) {
// When "neon" is on, NEON support is assumed.
bench_many_parents_fn(
b,
blake3_c_rust_bindings::ffi::neon::blake3_hash_many_neon,
blake3_c_rust_bindings::ffi::neon::iroh_blake3_hash_many_neon,
4,
);
}
Expand Down
4 changes: 2 additions & 2 deletions c/blake3_c_rust_bindings/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ pub mod ffi {
flags: u8,
out: *mut u8,
);
pub fn blake3_hash_many_portable(
pub fn iroh_blake3_hash_many_portable(
inputs: *const *const u8,
num_inputs: usize,
blocks: usize,
Expand Down Expand Up @@ -289,7 +289,7 @@ pub mod ffi {
pub mod neon {
extern "C" {
// NEON low level functions
pub fn blake3_hash_many_neon(
pub fn iroh_blake3_hash_many_neon(
inputs: *const *const u8,
num_inputs: usize,
blocks: usize,
Expand Down
8 changes: 4 additions & 4 deletions c/blake3_c_rust_bindings/src/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ pub fn test_hash_many_fn(hash_many_fn: HashManyFn) {
}
let mut portable_chunks_out = [0; NUM_INPUTS * OUT_LEN];
unsafe {
crate::ffi::blake3_hash_many_portable(
crate::ffi::iroh_blake3_hash_many_portable(
chunks.as_ptr() as _,
chunks.len(),
CHUNK_LEN / BLOCK_LEN,
Expand Down Expand Up @@ -272,7 +272,7 @@ pub fn test_hash_many_fn(hash_many_fn: HashManyFn) {
}
let mut portable_parents_out = [0; NUM_INPUTS * OUT_LEN];
unsafe {
crate::ffi::blake3_hash_many_portable(
crate::ffi::iroh_blake3_hash_many_portable(
parents.as_ptr() as _,
parents.len(),
1,
Expand Down Expand Up @@ -314,7 +314,7 @@ pub fn test_hash_many_fn(hash_many_fn: HashManyFn) {
// Testing the portable implementation against itself is circular, but why not.
#[test]
fn test_hash_many_portable() {
test_hash_many_fn(crate::ffi::blake3_hash_many_portable);
test_hash_many_fn(crate::ffi::iroh_blake3_hash_many_portable);
}

#[test]
Expand Down Expand Up @@ -356,7 +356,7 @@ fn test_hash_many_avx512() {
#[test]
#[cfg(feature = "neon")]
fn test_hash_many_neon() {
test_hash_many_fn(crate::ffi::neon::blake3_hash_many_neon);
test_hash_many_fn(crate::ffi::neon::iroh_blake3_hash_many_neon);
}

#[test]
Expand Down
5 changes: 2 additions & 3 deletions c/blake3_dispatch.c
Original file line number Diff line number Diff line change
Expand Up @@ -262,12 +262,11 @@ void blake3_hash_many(const uint8_t *const *inputs, size_t num_inputs,
#endif

#if BLAKE3_USE_NEON == 1
blake3_hash_many_neon(inputs, num_inputs, blocks, key, counter,
iroh_blake3_hash_many_neon(inputs, num_inputs, blocks, key, counter,
increment_counter, flags, flags_start, flags_end, out);
return;
#endif

blake3_hash_many_portable(inputs, num_inputs, blocks, key, counter,
iroh_blake3_hash_many_portable(inputs, num_inputs, blocks, key, counter,
increment_counter, flags, flags_start, flags_end,
out);
}
Expand Down
4 changes: 2 additions & 2 deletions c/blake3_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ void iroh_blake3_compress_xof_portable(const uint32_t cv[8],
uint8_t block_len, uint64_t counter,
uint8_t flags, uint8_t out[64]);

void blake3_hash_many_portable(const uint8_t *const *inputs, size_t num_inputs,
void iroh_blake3_hash_many_portable(const uint8_t *const *inputs, size_t num_inputs,
size_t blocks, const uint32_t key[8],
uint64_t counter, bool increment_counter,
uint8_t flags, uint8_t flags_start,
Expand Down Expand Up @@ -270,7 +270,7 @@ void iroh_blake3_hash_many_avx512(const uint8_t *const *inputs, size_t num_input
#endif

#if BLAKE3_USE_NEON == 1
void blake3_hash_many_neon(const uint8_t *const *inputs, size_t num_inputs,
void iroh_blake3_hash_many_neon(const uint8_t *const *inputs, size_t num_inputs,
size_t blocks, const uint32_t key[8],
uint64_t counter, bool increment_counter,
uint8_t flags, uint8_t flags_start,
Expand Down
6 changes: 3 additions & 3 deletions c/blake3_neon.c
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ INLINE void load_counters4(uint64_t counter, bool increment_counter,
counter_high(counter + (mask & 2)), counter_high(counter + (mask & 3)));
}

void blake3_hash4_neon(const uint8_t *const *inputs, size_t blocks,
void iroh_blake3_hash4_neon(const uint8_t *const *inputs, size_t blocks,
const uint32_t key[8], uint64_t counter,
bool increment_counter, uint8_t flags,
uint8_t flags_start, uint8_t flags_end, uint8_t *out) {
Expand Down Expand Up @@ -340,13 +340,13 @@ INLINE void hash_one_neon(const uint8_t *input, size_t blocks,
memcpy(out, cv, BLAKE3_OUT_LEN);
}

void blake3_hash_many_neon(const uint8_t *const *inputs, size_t num_inputs,
void iroh_blake3_hash_many_neon(const uint8_t *const *inputs, size_t num_inputs,
size_t blocks, const uint32_t key[8],
uint64_t counter, bool increment_counter,
uint8_t flags, uint8_t flags_start,
uint8_t flags_end, uint8_t *out) {
while (num_inputs >= 4) {
blake3_hash4_neon(inputs, blocks, key, counter, increment_counter, flags,
iroh_blake3_hash4_neon(inputs, blocks, key, counter, increment_counter, flags,
flags_start, flags_end, out);
if (increment_counter) {
counter += 4;
Expand Down
2 changes: 1 addition & 1 deletion c/blake3_portable.c
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ INLINE void hash_one_portable(const uint8_t *input, size_t blocks,
store_cv_words(out, cv);
}

void blake3_hash_many_portable(const uint8_t *const *inputs, size_t num_inputs,
void iroh_blake3_hash_many_portable(const uint8_t *const *inputs, size_t num_inputs,
size_t blocks, const uint32_t key[8],
uint64_t counter, bool increment_counter,
uint8_t flags, uint8_t flags_start,
Expand Down
4 changes: 2 additions & 2 deletions src/ffi_neon.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ pub unsafe fn hash_many<const N: usize>(
// array, but the C implementations don't. Even though this is an unsafe
// function, assert the bounds here.
assert!(out.len() >= inputs.len() * OUT_LEN);
ffi::blake3_hash_many_neon(
ffi::iroh_blake3_hash_many_neon(
inputs.as_ptr() as *const *const u8,
inputs.len(),
N / BLOCK_LEN,
Expand Down Expand Up @@ -54,7 +54,7 @@ pub extern "C" fn iroh_blake3_compress_in_place_portable(

pub mod ffi {
extern "C" {
pub fn blake3_hash_many_neon(
pub fn iroh_blake3_hash_many_neon(
inputs: *const *const u8,
num_inputs: usize,
blocks: usize,
Expand Down

0 comments on commit 77aaf09

Please sign in to comment.