public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Alan Modra <amodra@gmail.com>
To: Fangrui Song <i@maskray.me>
Cc: binutils@sourceware.org
Subject: Re: Support objcopy changing compression to or from zstd
Date: Thu, 6 Oct 2022 07:34:16 +1030	[thread overview]
Message-ID: <Yz3xUEa/glumhprz@squeak.grove.modra.org> (raw)
In-Reply-To: <20221004220134.ifx4i33v2obhzitr@gmail.com>

On Tue, Oct 04, 2022 at 03:01:34PM -0700, Fangrui Song wrote:
> 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.

I could have lived with objcopy --compress-debug-sections=zstd doing
nothing on already compressed sections.  After all, users could change
compression schemes by a two step process, first objcopy
--decompress-debug-sections then compress with the desired scheme.

However, I discovered that objcopy --compress-debug-sections=zstd
on a zlib-gnu compressed file copied the zlib data and tacked on a
header specifying zstd.  Which of course then causes errors on
attempted decompression.  That needed fixing regardless of what anyone
thinks objcopy --compress-debug-sections=zstd should do with already
compressed debug sections.

-- 
Alan Modra
Australia Development Lab, IBM

      parent reply	other threads:[~2022-10-05 21:04 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-04  8:13 Alan Modra
2022-10-04 22:01 ` Fangrui Song
2022-10-05  6:02   ` Jan Beulich
2022-10-05 21:04   ` Alan Modra [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Yz3xUEa/glumhprz@squeak.grove.modra.org \
    --to=amodra@gmail.com \
    --cc=binutils@sourceware.org \
    --cc=i@maskray.me \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).