Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 906367 - Support zstd for FEATURES="compressdebug" (--compress-debug-sections=zstd)
Summary: Support zstd for FEATURES="compressdebug" (--compress-debug-sections=zstd)
Status: CONFIRMED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Enhancement/Feature Requests (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Portage team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-05-15 04:48 UTC by Sam James
Modified: 2024-05-03 12:47 UTC (History)
5 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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
```