File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed
Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -204,11 +204,16 @@ host: x86_64-apple-darwin
204204# Use that target triple when building with build-std.
205205# Add the =std,panic_abort to the option to make panic = "abort" Cargo.toml option work.
206206# See: https://github.com/rust-lang/wg-cargo-std-aware/issues/56
207- $ RUSTFLAGS=" -Zlocation-detail=none" cargo +nightly build -Z build-std=std,panic_abort --target x86_64-apple-darwin --release
207+ $ RUSTFLAGS=" -Zlocation-detail=none" cargo +nightly build -Z build-std=std,panic_abort \
208+ -Z build-std-features=" std/optimize_for_size" \
209+ --target x86_64-apple-darwin --release
208210```
209211
210212On macOS, the final stripped binary size is reduced to 51KB.
211213
214+ The ` optimize_for_size ` flag provides a hint to libstd that it should try to use algorithms optimized
215+ for binary size. More information about it can be found [ here] ( https://github.com/rust-lang/rust/issues/125612 ) .
216+
212217# Remove ` panic ` String Formatting with ` panic_immediate_abort `
213218
214219![ Minimum Rust: Nightly] ( https://img.shields.io/badge/Minimum%20Rust%20Version-nightly-orange.svg )
You can’t perform that action at this time.
0 commit comments