Hello o/,
I'm working on compiling Rust crates as dynamic libraries (dylib
) to perform binary diffing for reverse engineering stripped Rust binaries. However, I'm encountering an issue that I can't resolve.
Here's the situation:
I'm using regex to download the necessary crates. Once downloaded, I modify the Cargo.toml
file by adding the following configuration to compile them as dynamic libraries, as suggested in this discussion: What is the difference between dylib and cdylib?
[lib]
crate-type = ["dylib"]
[profile.release]
panic="abort"
However, when I run cargo build --release
with this modified configuration, I receive the following error:
error: `#[panic_handler]` function required, but not found
warning: `aes` (lib) generated 32 warnings
error: could not compile `aes` (lib) due to 1 previous error; 32 warnings emitted
The solution i've found comes from here, and is to add a bit of code.
A Freestanding Rust Binary | Writing an OS in Rust. This seems to work, but i'm not sure that adding code is a good idea. Moreover, this seems to be for embedded developpement, while i'm targeting x86-64 linux/windows
My question is: Do you have a better idea on how to fix this problem without altering the code?