Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: hello-world-small example size update #50

Merged
merged 1 commit into from
Oct 10, 2024
Merged
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
6 changes: 3 additions & 3 deletions example-crates/hello-world-small/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Loading