public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Alan Modra <amodra@gmail.com>
To: "Martin Liška" <mliska@suse.cz>
Cc: binutils@sourceware.org
Subject: Re: [PATCH] compress .gnu.debuglto_.debug_* sections if requested
Date: Fri, 30 Sep 2022 09:50:46 +0930	[thread overview]
Message-ID: <YzY2XgesK1/mxcp8@squeak.grove.modra.org> (raw)
In-Reply-To: <7e8f08f2-6c4f-0bfb-8cd0-bec1bf6fe5c2@suse.cz>

On Thu, Sep 29, 2022 at 03:35:15PM +0200, Martin Liška wrote:
> +  /* Compress/decompress DWARF debug sections with names: .debug_*,
> +     .zdebug_*, .gnu.debuglto_.debug_, after the section flags is set.  */
>    if ((newsect->flags & SEC_DEBUGGING) != 0
>        && (newsect->flags & SEC_HAS_CONTENTS) != 0
> -      && ((name[1] == 'd' && name[6] == '_')
> -	  || (name[1] == 'z' && name[7] == '_')))
> +      && (startswith (name, ".debug_")
> +	  || startswith (name, ".zdebug_")
> +	  || startswith (name, ".gnu.debuglto_.debug_")))

If you test "(newsect->flags & SEC_ELF_OCTETS) != 0" as well, I think
you could omit any name tests here.  This would also compress
.gnu.linkonce.wi.* sections.  (Not that they matter very much, I'm
just pointing out a code simplification.)

> --- a/gas/write.c
> +++ b/gas/write.c
> @@ -1481,7 +1481,8 @@ compress_debug (bfd *abfd, asection *sec, void *xxx ATTRIBUTE_UNUSED)
>      return;
>  
>    section_name = bfd_section_name (sec);
> -  if (!startswith (section_name, ".debug_"))
> +  if (!startswith (section_name, ".debug_")
> +      && !startswith (section_name, ".gnu.debuglto_.debug_"))
>      return;
>  
>    bool use_zstd = abfd->flags & BFD_COMPRESS_ZSTD;

Hmm, it looks to me like this function will transform
".gnu.debuglto_.debug_*" to ".zgnu.debuglto_.debug_*" if
--compress-debug-sections=zlib-gnu is used, which will break your
elf.c change.  Please check --compress-debug-sections=zlib-gnu.

-- 
Alan Modra
Australia Development Lab, IBM

  reply	other threads:[~2022-09-30  0:20 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-29 13:35 Martin Liška
2022-09-30  0:20 ` Alan Modra [this message]
2022-09-30  7:19   ` Martin Liška
2022-10-04  8:07     ` Alan Modra
2022-10-04  8:12       ` Martin Liška
2022-10-04 13:41         ` Alan Modra

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=YzY2XgesK1/mxcp8@squeak.grove.modra.org \
    --to=amodra@gmail.com \
    --cc=binutils@sourceware.org \
    --cc=mliska@suse.cz \
    /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).