public inbox for elfutils@sourceware.org
 help / color / mirror / Atom feed
From: "Guillermo E. Martinez" <guillermo.e.martinez@oracle.com>
To: Mark Wielaard <mark@klomp.org>
Cc: Nick Clifton <nickc@redhat.com>, elfutils-devel@sourceware.org
Subject: Re: [PATCH v3] strip: keep .ctf section in stripped file
Date: Thu, 2 Mar 2023 20:40:58 -0600	[thread overview]
Message-ID: <20230303024058.42stfebtruwj4t3e@kamehouse> (raw)
In-Reply-To: <0f9fdbd9eaaa8a8e42b426d86a5aa977eef2d8e4.camel@klomp.org>

Hello Mark,

On Tue, Feb 28, 2023 at 03:27:13PM +0100, Mark Wielaard wrote:
> Hi Nick,
> 
> On Tue, 2023-02-28 at 12:59 +0000, Nick Clifton wrote:
> > > O, this surprises me. I wasn't aware binutils strip keeps unallocated
> > > sections by default. But apparently it does. It doesn't seem specific
> > > to ".ctf". Do you know why? This seems counter to how strip is supposed
> > > to behave, at least how I understand it.
> > 
> > Actually thinking about it, there are a few important un-allocated sections
> > that ought to be kept in a binary.  For example .gnu_debuglink and .shstrtab.
> > So maybe deleting unallocated sections by default is not such a good idea.
> 
> Sure, but both are those are actually added or rewritten during
> stripping.
> 
> There are some exceptions to the general rule in eu-strip of dropping
> not referenced, non-allocated, SHT_PROGBIT sections. SHT_NOTE sections
> are never removed (even if they aren't allocated), as are non-
> SHT_PROGBIT sections. ".gnu.warning." sections also aren't (even if
> they are non-allocated SHT_PROGBIT sections). And ".comment" sections
> aren't if not explicitly told to.
> 
> Guillermo's patch proposes to make ".ctf" another special case
> (defaulting to keeping).
> 
> I am mainly wondering why binutils strip already seems to keep ".ctf"
> sections (even without -g).
> 

I'm not plenty sure, but I can tell that it was done so, because CTF was
designed having in mind a lightweight debug format being shipped along with
the other allocated ELF sections:

	"CTF and DWARF data can coexist in the same ELF file, she said, since the
	CTF data has its own dedicated section. The CTF data is naturally
	smaller, but the format also includes compression to reduce the size
	requirements further. The result is that this data, unlike DWARF
	information, need not be stripped to get the executable file down to a
	reasonable size."

https://lwn.net/Articles/795384/

Kind regards,
guillermo

  reply	other threads:[~2023-03-03  2:41 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-31  2:26 [PATCH] " Guillermo E. Martinez
2022-05-31  7:06 ` Mark Wielaard
2022-05-31 10:26   ` Jose E. Marchesi
2022-05-31 12:50     ` Jose E. Marchesi
2022-06-01  4:34   ` Guillermo E. Martinez
2022-06-01 15:55   ` [PATCHv2] " Guillermo E. Martinez
2022-12-20 21:35     ` Mark Wielaard
2023-02-22 16:42       ` Mark Wielaard
2023-02-22 16:59         ` Jose E. Marchesi
2023-02-22 17:12         ` Guillermo E. Martinez
2023-02-22 23:04           ` Mark Wielaard
2023-02-23 18:34             ` Guillermo E. Martinez
2023-02-23 18:42     ` [PATCH v3] " Guillermo E. Martinez
2023-02-24 11:51       ` Mark Wielaard
2023-02-24 16:48         ` Guillermo E. Martinez
2023-02-28 12:24           ` Mark Wielaard
2023-02-28 12:45             ` Nick Clifton
2023-02-28 12:59             ` Nick Clifton
2023-02-28 14:27               ` Mark Wielaard
2023-03-03  2:40                 ` Guillermo E. Martinez [this message]
2023-03-03 12:15                   ` Mark Wielaard
2023-03-03 12:24                     ` Nick Clifton
2023-03-04 14:00                       ` Guillermo E. Martinez
2023-03-07 14:50                         ` Mark Wielaard
2023-03-07 20:47                           ` Guillermo E. Martinez
2023-03-08 17:45                           ` Nix
2023-03-09 23:08                             ` Mark Wielaard

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=20230303024058.42stfebtruwj4t3e@kamehouse \
    --to=guillermo.e.martinez@oracle.com \
    --cc=elfutils-devel@sourceware.org \
    --cc=mark@klomp.org \
    --cc=nickc@redhat.com \
    /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).