From 1fc57ed485fc325e03d883128139e0f5360984a9 Mon Sep 17 00:00:00 2001 From: Jubilee Young Date: Sun, 15 Sep 2024 14:26:14 -0700 Subject: [PATCH 1/2] Support symbolicating zstd-compressed ELF sections This requires bumping backtrace to rust-lang/backtrace-rs@4f3acf7 which includes support for symbolicating from newer Android APK formats, as well as for using zstd-compressed ELF sections for debuginfo. It also requires compiling ruzstd, a zstd decompressor written in Rust. This can combine with rust-lld's support for zstd-compressed debuginfo for overall smaller debuginfo sections. --- library/Cargo.lock | 12 ++++++++++++ library/backtrace | 2 +- library/std/Cargo.toml | 5 ++++- src/tools/tidy/src/deps.rs | 1 + 4 files changed, 18 insertions(+), 2 deletions(-) diff --git a/library/Cargo.lock b/library/Cargo.lock index ded30dd82f7b4..d1f58accbd286 100644 --- a/library/Cargo.lock +++ b/library/Cargo.lock @@ -312,6 +312,17 @@ dependencies = [ "std", ] +[[package]] +name = "ruzstd" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "99c3938e133aac070997ddc684d4b393777d293ba170f2988c8fd5ea2ad4ce21" +dependencies = [ + "compiler_builtins", + "rustc-std-workspace-alloc", + "rustc-std-workspace-core", +] + [[package]] name = "std" version = "0.0.0" @@ -336,6 +347,7 @@ dependencies = [ "rand", "rand_xorshift", "rustc-demangle", + "ruzstd", "std_detect", "unwind", "wasi", diff --git a/library/backtrace b/library/backtrace index 230570f2dac80..4f3acf7a0a9f6 160000 --- a/library/backtrace +++ b/library/backtrace @@ -1 +1 @@ -Subproject commit 230570f2dac80a601f5c0b30da00cc9480bd35eb +Subproject commit 4f3acf7a0a9f686ec004716e5d514d9732b41486 diff --git a/library/std/Cargo.toml b/library/std/Cargo.toml index 9a31fd21dc71a..87a2dfc087065 100644 --- a/library/std/Cargo.toml +++ b/library/std/Cargo.toml @@ -33,6 +33,7 @@ rustc-demangle = { version = "0.1.24", features = ['rustc-dep-of-std'] } [target.'cfg(not(all(windows, target_env = "msvc", not(target_vendor = "uwp"))))'.dependencies] miniz_oxide = { version = "0.7.0", optional = true, default-features = false } addr2line = { version = "0.22.0", optional = true, default-features = false } +ruzstd = { version = "0.7.2", default-features = false } [target.'cfg(not(all(windows, target_env = "msvc")))'.dependencies] libc = { version = "0.2.156", default-features = false, features = [ @@ -48,6 +49,7 @@ object = { version = "0.36.0", default-features = false, optional = true, featur 'unaligned', 'archive', ] } +ruzstd = { version = "0.7.2", default-features = false, optional = true, features = [ "rustc-dep-of-std"] } [target.'cfg(target_os = "aix")'.dependencies] object = { version = "0.36.0", default-features = false, optional = true, features = [ @@ -89,8 +91,9 @@ r-efi-alloc = { version = "1.0.0", features = ['rustc-dep-of-std'] } [features] backtrace = [ 'addr2line/rustc-dep-of-std', - 'object/rustc-dep-of-std', 'miniz_oxide/rustc-dep-of-std', + 'object/rustc-dep-of-std', + 'ruzstd/rustc-dep-of-std', ] panic-unwind = ["panic_unwind"] diff --git a/src/tools/tidy/src/deps.rs b/src/tools/tidy/src/deps.rs index 28367f25267f1..f08fd5f44172c 100644 --- a/src/tools/tidy/src/deps.rs +++ b/src/tools/tidy/src/deps.rs @@ -481,6 +481,7 @@ const PERMITTED_STDLIB_DEPENDENCIES: &[&str] = &[ "rand_core", "rand_xorshift", "rustc-demangle", + "ruzstd", "unicode-width", "unwinding", "wasi", From 6fb058ec51adeb031dc34c5e57619aa24613176d Mon Sep 17 00:00:00 2001 From: Jubilee Young Date: Sun, 15 Sep 2024 21:31:41 -0700 Subject: [PATCH 2/2] Skip debuginfo for ruzstd and opt it for size --- library/Cargo.toml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/library/Cargo.toml b/library/Cargo.toml index e744cfe5e0f57..f6d2598b1da94 100644 --- a/library/Cargo.toml +++ b/library/Cargo.toml @@ -38,6 +38,8 @@ gimli.opt-level = "s" miniz_oxide.debug = 0 object.debug = 0 rustc-demangle.debug = 0 +ruzstd.debug = 0 +ruzstd.opt-level = "s" [patch.crates-io] # See comments in `library/rustc-std-workspace-core/README.md` for what's going on