public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Jan Beulich <jbeulich@suse.com>
To: Alan Modra <amodra@gmail.com>
Cc: binutils@sourceware.org
Subject: Re: Don't attempt to compress bss sections
Date: Fri, 23 Sep 2022 08:33:05 +0200	[thread overview]
Message-ID: <07c50cd3-99d1-5262-b8d9-d70f9b0ae689@suse.com> (raw)
In-Reply-To: <Yy0ZX4tJ7D6tJ32m@squeak.grove.modra.org>

On 23.09.2022 04:26, Alan Modra via Binutils wrote:
> It doesn't make sense to try to compress a section without contents
> since those sections take no space on disk.  Compression can only
> increase the disk image size.
> 
> 	* coffgen.c (make_a_section_from_file): Exclude !SEC_HAS_CONTENTS
> 	sections from compression and decompression.
> 	* elf.c (_bfd_elf_make_section_from_shdr): Likewise.

So I'm curious - are there debugging sections without contents? Or
is the change more for the sake of documentation?

Jan

> --- a/bfd/coffgen.c
> +++ b/bfd/coffgen.c
> @@ -146,7 +146,8 @@ make_a_section_from_file (bfd *abfd,
>  
>    /* Compress/decompress DWARF debug sections with names: .debug_* and
>       .zdebug_*, after the section flags is set.  */
> -  if ((flags & SEC_DEBUGGING)
> +  if ((flags & SEC_DEBUGGING) != 0
> +      && (flags & SEC_HAS_CONTENTS) != 0
>        && strlen (name) > 7
>        && ((name[1] == 'd' && name[6] == '_')
>  	  || (strlen (name) > 8 && name[1] == 'z' && name[7] == '_')))
> diff --git a/bfd/elf.c b/bfd/elf.c
> index bc433cf516c..16cea4f8aeb 100644
> --- a/bfd/elf.c
> +++ b/bfd/elf.c
> @@ -1201,7 +1201,8 @@ _bfd_elf_make_section_from_shdr (bfd *abfd,
>  
>    /* Compress/decompress DWARF debug sections with names: .debug_* and
>       .zdebug_*, after the section flags is set.  */
> -  if ((newsect->flags & SEC_DEBUGGING)
> +  if ((newsect->flags & SEC_DEBUGGING) != 0
> +      && (newsect->flags & SEC_HAS_CONTENTS) != 0
>        && ((name[1] == 'd' && name[6] == '_')
>  	  || (name[1] == 'z' && name[7] == '_')))
>      {
> 


  reply	other threads:[~2022-09-23  6:33 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-23  2:26 Alan Modra
2022-09-23  6:33 ` Jan Beulich [this message]
2022-09-23  6:49   ` 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=07c50cd3-99d1-5262-b8d9-d70f9b0ae689@suse.com \
    --to=jbeulich@suse.com \
    --cc=amodra@gmail.com \
    --cc=binutils@sourceware.org \
    /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).