Skip to content

Commit

Permalink
Allow name-mangling for the mbedtls_free and mbedtls_calloc functions
Browse files Browse the repository at this point in the history
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 committed May 30, 2023
1 parent 0666c30 commit a798748
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 @@ -15,9 +15,9 @@ use core::mem::ManuallyDrop;
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) -> *mut mbedtls_sys::types::raw_types::c_void;
}

Expand Down

0 comments on commit a798748

Please sign in to comment.