Skip to content

Update README for stabe rustc strip flag and cargo strip feature release date #35

New issue

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

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

Already on GitHub? # to your account

Closed
wants to merge 1 commit into from
Closed
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
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ $ strip target/release/min-sized-rust
Available starting `1.45.0-nightly (2020-05-28)`,
[Cargo has `strip` functionality built in](https://doc.rust-lang.org/cargo/reference/unstable.html#profile-strip-option):

> Usage directly with `cargo` will be stabilized with rust [`1.59`](https://github.com/rust-lang/cargo/blob/master/CHANGELOG.md#cargo-159-2022-02-24)

![Minimum Rust: Nightly](https://img.shields.io/badge/Minimum%20Rust%20Version-nightly%201.45.0-orange.svg)

Modify `Cargo.toml` in this way:
Expand All @@ -60,6 +62,18 @@ cargo-features = ["strip"]
strip = true # Automatically strip symbols from the binary.
```

![Minimum Rust: 1.58](https://img.shields.io/badge/Minimum%20Rust%20Version-1.58-brightgreen.svg)

To avoid using the nightly, you can add the rustc flag that is now [stabilized](https://github.com/rust-lang/rust/blob/master/RELEASES.md#version-1580-2022-01-13) (since `1.58`).

Add the following to `.cargo/config`:

```toml
[build]
rustflags = ["-Cstrip=symbols"]
```
or build with `RUSTFLAGS='-C strip=symbols' cargo build --release`

# Optimize For Size

![Minimum Rust: 1.28](https://img.shields.io/badge/Minimum%20Rust%20Version-1.28-brightgreen.svg)
Expand Down