Skip to content

Commit dc2de12

Browse files
committed
Clarify Cargo strip instructions
1 parent 75b00ba commit dc2de12

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

README.md

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,26 +30,27 @@ $ cargo build --release
3030
# `strip` Symbols from Binary
3131

3232
![OS: *nix](https://img.shields.io/badge/OS-*nix-brightgreen.svg)
33+
![Minimum Rust: 1.59](https://img.shields.io/badge/Minimum%20Rust%20Version-1.59-brightgreen.svg)
3334

3435
By default on Linux and macOS, symbol information is included in the compiled `.elf` file. This
3536
information is not needed to properly execute the binary.
36-
To remove this, run [`strip`](https://linux.die.net/man/1/strip) on the `.elf` file:
37-
38-
```bash
39-
$ strip target/release/min-sized-rust
40-
```
41-
42-
[Cargo has `strip` functionality built in](https://doc.rust-lang.org/cargo/reference/profiles.html#strip):
43-
44-
![Minimum Rust: 1.59](https://img.shields.io/badge/Minimum%20Rust%20Version-1.59-brightgreen.svg)
4537

38+
Cargo can be configured to
39+
[automatically `strip` binaries](https://doc.rust-lang.org/cargo/reference/profiles.html#strip).
4640
Modify `Cargo.toml` in this way:
4741

4842
```toml
4943
[profile.release]
5044
strip = true # Automatically strip symbols from the binary.
5145
```
5246

47+
On Rust versions older than 1.59, run [`strip`](https://linux.die.net/man/1/strip) directly on
48+
the `.elf` file instead:
49+
50+
```bash
51+
$ strip target/release/min-sized-rust
52+
```
53+
5354
# Optimize For Size
5455

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

0 commit comments

Comments
 (0)