Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 906367

Summary: Support zstd for FEATURES="compressdebug" (--compress-debug-sections=zstd)
Product: Portage Development Reporter: Sam James <sam>
Component: Enhancement/Feature RequestsAssignee: Portage team <dev-portage>
Status: CONFIRMED ---    
Severity: normal CC: gentoo, josef64, kocelfc, srcshelton, toolchain
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
See Also: https://bugs.gentoo.org/show_bug.cgi?id=906368
Whiteboard:
Package list:
Runtime testing required: ---

Description Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-05-15 04:48:07 UTC
ELF now recognises zstd in addition to zlib (which we've used for years w/ FEATURES=compressdebug) for debug info compression. 

Right now, in bin/estrip, we pass `--compress-debug-sections` to objcopy. For zstd support, we need to do `--compress-debug-sections=zstd`.

It should be easy to make this configurable, we just need to bikeshed on the naming/method/variable name/whatever.

I've written up general usage instructions on the wiki at https://wiki.gentoo.org/wiki/Zstd#Debug_symbols.

A cheesy patch (*without* configurability) is:
```
Make Portage use zstd for debug info compression. Make sure binutils[zstd], elfutils[zstd], and gdb[zstd] are emerged first.
--- a/bin/estrip
+++ b/bin/estrip
@@ -295,7 +295,7 @@ save_elf_debug() {
 			mv "${splitdebug}" "${dst}"
 		else
 			local objcopy_flags="--only-keep-debug"
-			${FEATURES_compressdebug} && objcopy_flags+=" --compress-debug-sections"
+			${FEATURES_compressdebug} && objcopy_flags+=" --compress-debug-sections=zstd"
 			${OBJCOPY} ${objcopy_flags} "${src}" "${dst}" &&
 			${OBJCOPY} --add-gnu-debuglink="${dst}" "${src}"
 		fi
```