Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion boring-sys/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ license = "MIT"
description = "FFI bindings to BoringSSL"
repository = { workspace = true }
documentation = "https://docs.rs/boring-sys2"
links = "boringssl"
links = "b2_boringssl"
build = "build/main.rs"
readme = "README.md"
categories = ["cryptography", "external-ffi-bindings"]
Expand Down
2 changes: 1 addition & 1 deletion boring-sys/build/prefix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ impl bindgen::callbacks::ParseCallbacks for PrefixCallback {
&self,
item_info: bindgen::callbacks::ItemInfo<'_>,
) -> Option<String> {
Some(format!("{PREFIX}_{}", item_info.name))
Some(format!("b2_{PREFIX}_{}", item_info.name))
}
Comment on lines 16 to 18
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

This change correctly adds the b2_ prefix for the symbols in the bindgen-generated FFI bindings. However, this is incomplete and will lead to linker errors.

The prefix_symbols function in this same file is responsible for renaming the symbols in the compiled native library using objcopy. It has not been updated to use the same b2_ prefix. As a result, the Rust code will try to link against symbols like b2_boring-sys2_... which will not exist in the library (they will be named boring-sys2_...).

To fix this, you need to update the symbol renaming logic in prefix_symbols to be consistent. Please change line 64 to:

.map(|l| format!("{l} b2_{PREFIX}_{l}"))

}

Expand Down