Skip to content

Commit 31848a7

Browse files
committed
Allow name-mangling for the mbedtls_free, mbedtls_calloc and mbedtls_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.
1 parent f9fefe0 commit 31848a7

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

mbedtls/src/alloc.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ use core::mem::ManuallyDrop;
1515
use mbedtls_sys::types::raw_types::c_void;
1616

1717
extern "C" {
18-
#[link_name = concat!("\u{1}forward_mbedtls_free_", env!("RUST_MBEDTLS_METADATA_HASH"))]
18+
#[link_name = concat!("forward_mbedtls_free_", env!("RUST_MBEDTLS_METADATA_HASH"))]
1919
pub(crate) fn mbedtls_free(n: *mut mbedtls_sys::types::raw_types::c_void);
20-
#[link_name = concat!("\u{1}forward_mbedtls_calloc_", env!("RUST_MBEDTLS_METADATA_HASH"))]
20+
#[link_name = concat!("forward_mbedtls_calloc_", env!("RUST_MBEDTLS_METADATA_HASH"))]
2121
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;
2222
}
2323

mbedtls/src/ssl/context.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,10 +108,10 @@ define!(
108108
);
109109

110110
extern "C" {
111-
// Since in mbedtld 3.X, upstream hide the `mbedtls_ssl_flush_output`, but we still need it for
111+
// Since in mbedtls 3.X, upstream hide the `mbedtls_ssl_flush_output`, but we still need it for
112112
// async here. Ref: https://github.com/Mbed-TLS/mbedtls/issues/4183
113113
// So we mannully access it through defining it in `extern "C"` here
114-
#[link_name = "\u{1}mbedtls_ssl_flush_output"]
114+
#[link_name = "mbedtls_ssl_flush_output"]
115115
fn ssl_flush_output(ssl: *mut ssl_context) -> c_int;
116116
}
117117

0 commit comments

Comments
 (0)