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.
See https://sourceware.org/bugzilla/show_bug.cgi?id=29397 for binutils feature request.
gdb will need to support SHF_COMPRESSED (ch_type=ELFCOMPRESS_ZSTD) .debug_* sections in executables, shared objects, and (split DWARF) .dwo files.
llvm-project has some components supporting zstd now. Some instructions for developers who want to test gdb's support:
git clone https://github.com/facebook/zstd
cmake -GNinja -Hbuild/cmake -Bout/release -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/tmp/opt/zstd
make -j 8 install
# See https://llvm.org/docs/GettingStarted.html
# Example: cmake -GNinja -Sllvm -Bout/release -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_PROJECTS='clang;lld' -DLLVM_ENABLE_ZSTD=FORCE_ON -DCMAKE_PREFIX_PATH=/tmp/opt/zstd; ninja -C out/release llvm-objcopy clang lld
You can create zstd output with
out/release/bin/llvm-objcopy --compress-debug-sections=zstd a.out a.out.zstd
or out/release/bin/clang -fuse-ld=lld -gz=zstd a.o b.o ...
Due to gdb's use of bfd/compress.c, this actually has to be supported in the same patch that adds zstd support to bfd/. Here it is.
https://sourceware.org/pipermail/gdb-patches/2022-September/191915.html [PATCH] binutils, gdb: support zstd compressed debug sections
I have tested gdb with a zstd-compressed lld.