From 27e650b6ef966da71e0801a3f2d2d341203d2aef Mon Sep 17 00:00:00 2001 From: "@permadeath.com" Date: Sat, 5 Sep 2026 15:32:32 -0400 Subject: [PATCH] build: add a release profile with LTO, strip and overflow checks The workspace had `[profile.dev]` and `[profile.test]` but nothing for `[profile.release]`, so the shipped binary got no LTO, default codegen units and no symbol stripping. `overflow-checks` stays on past the profile's usual default of off, because the CBOR, CAR and WAL frame parsers do length and offset arithmetic on bytes read straight off the network, and a silent wraparound there is a correctness bug. Change-Id: I7227147df17a0fe9250e9eb304b1144b678ac539 --- Cargo.toml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/Cargo.toml b/Cargo.toml index 369c4655..3b7c34b5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -163,6 +163,20 @@ debug = "line-tables-only" [profile.test] debug = "line-tables-only" +# `lto` and one codegen unit are what actually ship: this is what runs on the +# public internet, built once and run for months, so the extra link time is +# worth a smaller and faster binary. `strip` drops the symbols that buys. +# +# `overflow-checks` stays on despite the profile's default of off. The CBOR, +# CAR and WAL frame parsers do length and offset arithmetic on bytes read +# straight off the network, and a silent wraparound there is a correctness +# bug, not a slow path worth optimizing away. +[profile.release] +lto = "fat" +codegen-units = 1 +strip = true +overflow-checks = true + [workspace.lints.rust] missing_docs = "warn" -- 2.51.2