From 7e3b27508723d8a2e87d356d0e9e18b442a4d0c4 Mon Sep 17 00:00:00 2001 From: Ed Morley <501702+edmorley@users.noreply.github.com> Date: Sat, 26 Feb 2022 16:47:12 +0000 Subject: [PATCH] Add `strip=true` to the repo examples Enables strip in the example `Cargo.toml` files in this repository, per the recommendation now in README after #34. The reminder to `strip` has been removed from the README, since the examples will now do that automatically. --- Cargo.toml | 1 + README.md | 4 ++-- build_std/Cargo.toml | 1 + no_main/Cargo.toml | 1 + no_std/Cargo.toml | 1 + 5 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 95ecc0d..1db9e9d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -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. diff --git a/README.md b/README.md index b06327f..200f324 100644 --- a/README.md +++ b/README.md @@ -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` @@ -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` diff --git a/build_std/Cargo.toml b/build_std/Cargo.toml index f3fdf1c..f80c8ce 100644 --- a/build_std/Cargo.toml +++ b/build_std/Cargo.toml @@ -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. diff --git a/no_main/Cargo.toml b/no_main/Cargo.toml index af9b5d4..cb3b7d6 100644 --- a/no_main/Cargo.toml +++ b/no_main/Cargo.toml @@ -18,3 +18,4 @@ opt-level = "z" lto = true codegen-units = 1 panic = "abort" +strip = true diff --git a/no_std/Cargo.toml b/no_std/Cargo.toml index d45d977..3d6c47b 100644 --- a/no_std/Cargo.toml +++ b/no_std/Cargo.toml @@ -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.