A very small Rust binary indeed
Updated 2022-10-30
How small can we make an x86_64 Linux Rust binary? Can it compete with a pure assembly program? Let’s find out! On the way we’ll learn things about how programs are loaded on Linux and appreciate how flexible Rust can be.
Starting point: 3.6 MiB
Create a project: cargo new --vcs=none smallrs
Replace src/main.rs with the simplest possible Rust program:
fn main() {
std::process::exit(42)
}
You might argue that this isn’t the simplest possible Rust program: fn main() { } would be...
Read more at darkcoding.net