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

Add more code-size optimization flags. #55

Merged
merged 1 commit into from
Nov 27, 2024
Merged
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 example-crates/hello-world-small/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ It uses the [workaround to support -Zbuild-std], and can be built with
a command like this:

```console
$ 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
$ RUSTFLAGS="-Z location-detail=none -Zfmt-debug=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,optimize_for_size --target x86_64-unknown-linux-gnu --release
```

This applies all the techniques described on the [min-sized-rust] page
Expand Down
4 changes: 2 additions & 2 deletions tests/example_crates.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,11 @@ fn example_crate_hello_world_small() {
&[
"--release",
"-Zbuild-std=std,panic_abort",
"-Zbuild-std-features=panic_immediate_abort",
"-Zbuild-std-features=panic_immediate_abort,optimize_for_size",
],
&[(
"RUSTFLAGS",
"-Zlocation-detail=none -Crelocation-model=static -Ctarget-feature=+crt-static",
"-Zlocation-detail=none -Zfmt-debug=none -Crelocation-model=static -Ctarget-feature=+crt-static",
)],
"Hello, world!\n",
"",
Expand Down