Skip to content

Commit

Permalink
Allow name-mangling for the mbedtls_free, mbedtls_calloc and mbedtls_…
Browse files Browse the repository at this point in the history
…ssl_flush_output functions

According to the discussion in
rust-lang/rust-bindgen#1221 (comment),
the \u{1} is a hint to LLVM to avoid name-mangling but this might be required
on some platforms to link against the right name, e.g. on macOS.
  • Loading branch information
DrTobe authored and Taowyoo committed Nov 2, 2023
1 parent 0a79c87 commit b380ff7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions mbedtls/src/alloc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ use core::ptr::NonNull;
use mbedtls_sys::types::raw_types::c_void;

extern "C" {
#[link_name = concat!("\u{1}forward_mbedtls_free_", env!("RUST_MBEDTLS_METADATA_HASH"))]
#[link_name = concat!("forward_mbedtls_free_", env!("RUST_MBEDTLS_METADATA_HASH"))]
pub(crate) fn mbedtls_free(n: *mut mbedtls_sys::types::raw_types::c_void);
#[link_name = concat!("\u{1}forward_mbedtls_calloc_", env!("RUST_MBEDTLS_METADATA_HASH"))]
#[link_name = concat!("forward_mbedtls_calloc_", env!("RUST_MBEDTLS_METADATA_HASH"))]
pub(crate) fn mbedtls_calloc(
n: mbedtls_sys::types::size_t,
size: mbedtls_sys::types::size_t,
Expand Down

0 comments on commit b380ff7

Please sign in to comment.