From 5a94b6c5b09bd56ed7395332e2ada0c677b17a17 Mon Sep 17 00:00:00 2001 From: Kai Lueke Date: Tue, 5 Dec 2023 13:37:01 +0100 Subject: [PATCH] Cargo.toml: Add release profile for smaller size and overflow checks The release binary should be as small as possible without impact. Since this is new code we also want the release binary to still have overflow checks instead of silently eating them. Add a release profile that strips the debug symbols, uses one codegen unit to get similar gains as thin LTO (which we seem to have cross- compiling problems with), and enable overflow checks. --- Cargo.toml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Cargo.toml b/Cargo.toml index 0240a92..8375a8a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -38,3 +38,14 @@ members = [ [[bin]] name = "crau_verify" path = "test/crau_verify.rs" + +[profile.release] +# We do some offset calculations for extraction and +# the generated protobuf code does even more, let's +# be cautious +overflow-checks = true +# Reduce binary size by stripping debug symbols +strip = true +# Reduce binary size by using one codegen unit for similar gains as thin LTO +# (which we had problem with when cross-compiling) +codegen-units = 1