From 5a96c779de029d865e34f8b2c7beed1b842d76b2 Mon Sep 17 00:00:00 2001 From: Brennan Kinney <5098581+polarathene@users.noreply.github.com> Date: Fri, 11 Oct 2024 10:37:21 +1300 Subject: [PATCH] docs: `hello-world-small` example size update (#50) --- example-crates/hello-world-small/README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/example-crates/hello-world-small/README.md b/example-crates/hello-world-small/README.md index e3148b7..79afc39 100644 --- a/example-crates/hello-world-small/README.md +++ b/example-crates/hello-world-small/README.md @@ -7,16 +7,16 @@ It uses the [workaround to support -Zbuild-std], and can be built with a command like this: ```console -$ RUSTFLAGS="-Zlocation-detail=none -C relocation-model=static -Ctarget-feature=+crt-static" cargo +nightly run -Z build-std=std,panic_abort -Z build-std-features=panic_immediate_abort --target x86_64-unknown-linux-gnu --release +$ RUSTFLAGS="-Z location-detail=none -C relocation-model=static -Ctarget-feature=+crt-static" cargo +nightly run -Z build-std=std,panic_abort -Z build-std-features=panic_immediate_abort --target x86_64-unknown-linux-gnu --release ``` This applies all the techniques described on the [min-sized-rust] page before [Remove `core::fmt` with `no_main` and Careful Usage of `libstd`]. -As of this writing, this compiles to 37880 bytes. For comparison, using all +As of this writing, this compiles to 24,616 bytes. For comparison, using all these same optimizations without Eyra, and using `x86_64-unknown-linux-musl` (which produces smaller statically-linked binaries than -`x86_64-unknown-linux-gnu`), compiles to 50776 bytes. +`x86_64-unknown-linux-gnu`), compiles to 30,288 bytes. If you're interested in going further down the `#![no_main]`/`#![no_std]` path, consider [using Origin directly] which can get down to 408 bytes. Or,