Skip to content

Commit

Permalink
Add strip=true to the repo examples
Browse files Browse the repository at this point in the history
Enables strip in the example `Cargo.toml` files in this repository,
per the recommendation now in README after johnthagen#34.

The reminder to `strip` has been removed from the README,
since the examples will now do that automatically.
  • Loading branch information
edmorley committed Feb 26, 2022
1 parent 7521052 commit 7e3b275
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ opt-level = "z" # Optimize for size.
lto = true # Enable Link Time Optimization
codegen-units = 1 # Reduce number of codegen units to increase optimizations.
panic = "abort" # Abort on panic
strip = true # Automatically strip symbols from the binary.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ host: x86_64-apple-darwin
$ cargo +nightly build -Z build-std=std,panic_abort --target x86_64-apple-darwin --release
```

Remember to `strip` the resulting executable. On macOS, the final binary size is reduced to 51KB.
On macOS, the final stripped binary size is reduced to 51KB.

# Remove `panic` String Formatting with `panic_immediate_abort`

Expand All @@ -205,7 +205,7 @@ $ cargo +nightly build -Z build-std=std,panic_abort -Z build-std-features=panic_
--target x86_64-apple-darwin --release
```

Remember to `strip` the resulting executable. On macOS, the final binary size is reduced to 30KB.
On macOS, the final stripped binary size is reduced to 30KB.

# Remove `core::fmt` with `#![no_main]` and Careful Usage of `libstd`

Expand Down
1 change: 1 addition & 0 deletions build_std/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@ opt-level = "z" # Optimize for size.
lto = true # Enable Link Time Optimization
codegen-units = 1 # Reduce number of codegen units to increase optimizations.
panic = "abort" # Abort on panic
strip = true # Automatically strip symbols from the binary.
1 change: 1 addition & 0 deletions no_main/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@ opt-level = "z"
lto = true
codegen-units = 1
panic = "abort"
strip = true
1 change: 1 addition & 0 deletions no_std/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@ opt-level = "z" # Optimize for size.
lto = true # Enable Link Time Optimization
codegen-units = 1 # Reduce number of codegen units to increase optimizations.
panic = "abort" # Abort on panic
strip = true # Automatically strip symbols from the binary.

0 comments on commit 7e3b275

Please sign in to comment.