This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: Should strip discard the .ctf section ?
Hi,
On Mon, 7 Oct 2019, Orlando Arias wrote:
> On 10/7/19 2:52 PM, Nick Alcock wrote:
> > Maybe, but I'm... not aware that there is actually a problem that needs
> > a new flag to solve it here. There is a default that you dislike, but I
> > don't actually know why you dislike it: if it leads to worse behaviour
> > for end-users I'm not aware of it. That users get to keep .ctf sections
> > once they explicitly ask for them to be generated seems like a *benefit*
> > to me.
>
> The problem is that you are arguing for a default that goes against the
> behavior of the tool. When I run strip, I expect all symbols from the
> object file to be discarded.
But strip doesn't only "remove symbols". It removes an effectively
arbitrary set of sections and meta information of files, and that set
historically happens to be "somewhat-related-to-debug-thingies", with one
invariant being that after stripping a final executable it still must run
as before stripping (1). Stripping relocatable files already breaks this
(and that noone is surprised by this is merely experience and historic
behaviour; a complete newcomer might say that's a bug in strip, because
"it should only remove debug stuff, not symbols", and that would be
reasonable)
[(1) and there are even GNU libraries that actually do break by stripping
them, e.g. glibcs libpthread/libthread_db in the past, when it played
games with existence of .symtab entries.]
And let's be honest, there are only two reasons why something like strip
exists at all: (a) hiding of internal information from 3rd parties,
whatever we think the effectiveness of that is, and (b) to remove stuff
that's mind-boggingly large for it's usefulness (hello stabs and DWARF).
With my distro hat on: if I could get the biggest usefulness of DWARF for
shipped binaries (namely halfway sensible backtraces and typeinfo for the
arguments, so that crash debugging by hand at remote sites doesn't turn
your brain into a complete sponge) for, say, 10% of .text, then _of
course_ I want to have that shipped with the binaries.
So, yeah, don't strip .ctf by default. Though, of course, again with my
distro hat: I could cope with default stripping, I'd simply patch our
binutils to not strip :)
> I do not wish having to pass an extra
> --remove-section=.cft because the behavior of strip suddenly changed to
> something that is removed from the norm.
Then use strip -s (aka --strip-all).
Ciao,
Michael.