Support objcopy changing compression to or from zstd

Fangrui Song i@maskray.me
Tue Oct 4 22:01:34 GMT 2022


On 2022-10-04, Alan Modra via Binutils wrote:
>Commit 2cac01e3ffff lacked support for objcopy changing compression
>style.  Add that support, which meant a rewrite of
>bfd_compress_section_contents.  In the process I've fixed some memory
>leaks.

For objcopy --compress-debug-sections=zstd , I know that omitting
recompression of zlib into zstd was intentional.  --compress-debug-sections=zstd 
does not specify what to do when a section is compressed, so both (a)
do nothing (b) re-compression with zstd are fine but I think
avoiding recompression can avoid some complexity...

If a .o is compressed with zlib level 5, should --compress-debug-sections=zlib
re-compress it or leave it as-is?

At any rate, I think the  objcopy --compress-debug-sections=zstd
behavior with zlib compressed sections is mostly not interesting to a
user.


More information about the Binutils mailing list