Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

kbuild: rust: use `-Zdebuginfo-compression`

Rust 1.74.0 introduced (unstable) support for the
`-Zdebuginfo-compression` flag, thus use it.

Note that the releases built by the Rust project (i.e. the ones provided
by rustup) do not enable support for zstd in their bundled LLVM (yet,
at least), thus the Rust compiler will warn, but the build will proceed:

warning: unknown debuginfo compression algorithm zstd - will fall
back to uncompressed debuginfo

Link: https://github.com/rust-lang/rust/issues/120953
Link: https://github.com/rust-lang/rust/pull/115358
Reviewed-by: Alice Ryhl <aliceryhl@google.com>
Link: https://lore.kernel.org/r/20240217002622.57322-1-ojeda@kernel.org
[ Added note about zstd support in Rust-provided binaries. ]
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>

+2
+2
scripts/Makefile.debug
··· 35 35 36 36 ifdef CONFIG_DEBUG_INFO_COMPRESSED_ZLIB 37 37 DEBUG_CFLAGS += -gz=zlib 38 + DEBUG_RUSTFLAGS += -Zdebuginfo-compression=zlib 38 39 KBUILD_AFLAGS += -gz=zlib 39 40 KBUILD_LDFLAGS += --compress-debug-sections=zlib 40 41 else ifdef CONFIG_DEBUG_INFO_COMPRESSED_ZSTD 41 42 DEBUG_CFLAGS += -gz=zstd 43 + DEBUG_RUSTFLAGS += -Zdebuginfo-compression=zstd 42 44 KBUILD_AFLAGS += -gz=zstd 43 45 KBUILD_LDFLAGS += --compress-debug-sections=zstd 44 46 endif