Bug 29397 - binutils: support zstd for SHF_COMPRESSED debug sections
Summary: binutils: support zstd for SHF_COMPRESSED debug sections
Status: NEW
Alias: None
Product: binutils
Classification: Unclassified
Component: binutils (show other bugs)
Version: unspecified
: P2 normal
Target Milestone: ---
Assignee: Fangrui Song
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-07-24 07:17 UTC by Fangrui Song
Modified: 2022-09-26 22:06 UTC (History)
7 users (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Fangrui Song 2022-07-24 07:17:11 UTC
Zstandard is a "universal" compression algorithm which scales from low-ratio-very-fast to high-ratio-pretty-slow.
The generic-abi proposal https://groups.google.com/g/generic-abi/c/satyPkuMisk ("Add new ch_type value: ELFCOMPRESS_ZSTD") has been approved.

The default zstd -3 is easily 7x as fast as zlib level 1 while having a higher compression ratio.

See also https://sourceware.org/pipermail/gnu-gabi/2022q2/000498.html

binutils may need to:

* optional: import zstd/ as a toplevel directory like zlib/
* add configure.ac option --with-system-zstd
* gas: add --compress-debug-sections=zstd
* objcopy: add --compress-debug-sections=zstd
* ld: support ELFCOMPRESS_ZSTD input, add --compress-debug-sections=zstd
Comment 1 Fangrui Song 2022-07-25 07:45:14 UTC
Add more tools to the list:

* nm
* addr2line

For objcopy --compress-debug-sections=zstd , I think it should apply only to uncompressed .debug_* sections. If a section is compressed by zlib, the format should not change.
If a user wants to ensure zlib sections are converted to zstd, run --decompress-debug-sections first.
Comment 2 Fangrui Song 2022-09-19 04:03:16 UTC
https://sourceware.org/pipermail/gdb-patches/2022-September/191915.html [PATCH] binutils, gdb: support zstd compressed debug sections
Comment 3 Fangrui Song 2022-09-26 22:06:43 UTC
(In reply to Fangrui Song from comment #2)
> https://sourceware.org/pipermail/gdb-patches/2022-September/191915.html
> [PATCH] binutils, gdb: support zstd compressed debug sections

The latest version is at https://sourceware.org/pipermail/binutils/2022-September/123085.html . The gdb part has been approved.