chore(core): optimize size of build artifacts
What changed, and why it matters
This commit adjusts build settings to make compiled helper programs and build outputs smaller. It strips debug symbols, reduces optimization for size, and changes the debug-info flag for C code from detailed to basic. There is no indication this affects the security of the actual Trezor firmware that runs on the device.
No security action required. Treat as a routine build optimization.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The commit modifies Cargo profiles for build scripts and the xtask helper binary to strip symbols and optimize for size. It also changes the C compiler debug flag from ‘-g3 -ggdb’ to ‘-g’ in models/build.rs. These are build-hygiene changes aimed at reducing artifact size, not at changing runtime behavior or fixing a vulnerability.
Changed components
core/embed/.cargo/config.tomlcore/embed/Cargo.tomlcore/embed/models/build.rsInspect captured patch +20 / −3
diff --git a/core/embed/.cargo/config.toml b/core/embed/.cargo/config.toml
index a4d08cb7..5357d45a 100644
--- a/core/embed/.cargo/config.toml
+++ b/core/embed/.cargo/config.toml
@@ -3,7 +3,7 @@ target-dir = "../build-xtask"
#rustc-wrapper = "sccache"
[alias]
-xtask = "run -p xtask --"
+xtask = "run --profile xtask -p xtask --"
[target.x86_64-unknown-linux-gnu]
diff --git a/core/embed/Cargo.toml b/core/embed/Cargo.toml
index 4891c86a..1896c619 100644
--- a/core/embed/Cargo.toml
+++ b/core/embed/Cargo.toml
@@ -53,6 +53,24 @@ opt-level = 3
split-debuginfo = "off"
debug = 2
+# Optimized profile for build related binaries
+[profile.release.build-override]
+debug = false
+strip = true
+opt-level = "s"
+
+# Optimized profile for build related binaries
+[profile.dev.build-override]
+debug = false
+strip = true
+opt-level = "s"
+
+# Optimized profile for xtask binary
+[profile.xtask]
+inherits = "dev"
+debug = false
+strip = true
+
[workspace.dependencies]
cfg-if = "1.0"
cty = "0.2.2"
diff --git a/core/embed/models/build.rs b/core/embed/models/build.rs
index 29999eaa..bd692e9d 100644
--- a/core/embed/models/build.rs
+++ b/core/embed/models/build.rs
@@ -53,8 +53,7 @@ fn main() -> Result<()> {
"-fsingle-precision-constant",
"-fdata-sections",
"-ffunction-sections",
- "-g3",
- "-ggdb",
+ "-g",
]);
if cfg!(feature = "emulator") {
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.