File tree Expand file tree Collapse file tree 1 file changed +10
-9
lines changed Expand file tree Collapse file tree 1 file changed +10
-9
lines changed Original file line number Diff line number Diff line change @@ -30,26 +30,27 @@ $ cargo build --release
30
30
# ` strip ` Symbols from Binary
31
31
32
32
![ 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 )
33
34
34
35
By default on Linux and macOS, symbol information is included in the compiled ` .elf ` file. This
35
36
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 )
45
37
38
+ Cargo can be configured to
39
+ [ automatically ` strip ` binaries] ( https://doc.rust-lang.org/cargo/reference/profiles.html#strip ) .
46
40
Modify ` Cargo.toml ` in this way:
47
41
48
42
``` toml
49
43
[profile .release ]
50
44
strip = true # Automatically strip symbols from the binary.
51
45
```
52
46
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
+
53
54
# Optimize For Size
54
55
55
56
![ Minimum Rust: 1.28] ( https://img.shields.io/badge/Minimum%20Rust%20Version-1.28-brightgreen.svg )
You can’t perform that action at this time.
0 commit comments