perf: set panic=abort and drop backtrace features (#342)

Reduces binary size of the updater staticlib when linked into the
Flutter engine. On host macOS arm64 the dylib shrinks from 3.07 MB
to 2.56 MB; the biggest iOS savings come from dropping the DWARF
unwind tables (__eh_frame, __gcc_except_tab, __unwind_info) that
panic=unwind generates.

- panic = "abort" in [profile.release]: kills unwind-table generation
  and eliminates dead panic-unwinding code paths. We don't use
  catch_unwind anywhere in the library. log-panics still runs its
  panic hook before abort, so panic messages continue to surface to
  logcat/oslog during development.
- Drop `backtrace` feature from anyhow and `with-backtrace` from
  log-panics: removes gimli + addr2line + rustc_demangle (~65 KB of
  symbolication machinery) that customers can't read anyway. A
  future in-engine crash reporter will symbolize native stacks,
  making these features redundant.
This commit is contained in:
Eric Seidel
2026-04-21 12:01:26 -07:00
committed by GitHub
parent ca8f0a9f36
commit db99e24726
3 changed files with 4 additions and 49 deletions
Generated
-46
View File
@@ -2,15 +2,6 @@
# It is not intended for manual editing.
version = 4
[[package]]
name = "addr2line"
version = "0.25.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1b5d307320b3181d6d7954e663bd7c774a838b8220fe0593c86d9fb09f498b4b"
dependencies = [
"gimli",
]
[[package]]
name = "adler2"
version = "2.0.1"
@@ -121,21 +112,6 @@ version = "1.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8"
[[package]]
name = "backtrace"
version = "0.3.76"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bb531853791a215d7c62a30daf0dde835f381ab5de4589cfe7c649d2cbe92bd6"
dependencies = [
"addr2line",
"cfg-if",
"libc",
"miniz_oxide",
"object",
"rustc-demangle",
"windows-link",
]
[[package]]
name = "base64"
version = "0.22.1"
@@ -638,12 +614,6 @@ dependencies = [
"wasip3",
]
[[package]]
name = "gimli"
version = "0.32.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e629b9b98ef3dd8afe6ca2bd0f89306cec16d43d907889945bc5d6687f2f13c7"
[[package]]
name = "h2"
version = "0.4.13"
@@ -994,7 +964,6 @@ version = "2.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "68f9dd8546191c1850ecf67d22f5ff00a935b890d0e84713159a55495cc2ac5f"
dependencies = [
"backtrace",
"log",
]
@@ -1106,15 +1075,6 @@ dependencies = [
"libc",
]
[[package]]
name = "object"
version = "0.37.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ff76201f031d8863c38aa7f905eca4f53abbfa15f609db4277d44cd8938f33fe"
dependencies = [
"memchr",
]
[[package]]
name = "once_cell"
version = "1.21.4"
@@ -1390,12 +1350,6 @@ dependencies = [
"windows-sys 0.52.0",
]
[[package]]
name = "rustc-demangle"
version = "0.1.27"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b50b8869d9fc858ce7266cce0194bd74df58b9d0e3f6df3a9fc8eb470d95c09d"
[[package]]
name = "rustix"
version = "1.1.4"
+1
View File
@@ -7,3 +7,4 @@ opt-level = "z"
lto = true
codegen-units = 1
strip = "debuginfo"
panic = "abort"
+3 -3
View File
@@ -13,7 +13,7 @@ crate-type = ["lib", "cdylib", "staticlib"]
[dependencies]
# Used for error handling for now.
anyhow = { version = "1.0.69", features = ["backtrace"] }
anyhow = "1.0.69"
base64 = "0.22.0"
# For inflating compressed patch files.
bipatch = "1.0.0"
@@ -50,11 +50,11 @@ zip = { version = "8.5.1", default-features = false, features = ["deflate"] }
# For logging to Android logcat.
android_logger = "0.15.0"
# Send panics to log (instead of stderr), thus logcat on Android.
log-panics = { version = "2", features = ["with-backtrace"] }
log-panics = "2"
[target.'cfg(any(target_os = "ios", target_os = "macos"))'.dependencies]
# Send panics to syslog (instead of stderr).
log-panics = { version = "2", features = ["with-backtrace"] }
log-panics = "2"
# Support for logging on iOS (https://developer.apple.com/documentation/oslog)
oslog = "0.2.0"