bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug binutils/29737] strip: section attributes to indicate strip or pers


From: nickc at redhat dot com
Subject: [Bug binutils/29737] strip: section attributes to indicate strip or persistent sections
Date: Wed, 02 Nov 2022 12:42:28 +0000

https://sourceware.org/bugzilla/show_bug.cgi?id=29737

--- Comment #5 from Nick Clifton <nickc at redhat dot com> ---
(In reply to Guillermo E. Martinez from comment #4)
Hi Guillermo,

> > Are you asking for strip to be able to keep or remove sections based upon
> > their attributes, rather than their names ?   
> 
> Exactly. This bugzilla is to provide the feedback and support triggered by
> the discussion for standardize a way to indicates whether sections should be
> preserved or not after binutils strip/eu-strip execution without need to use
> special arguments,  

OK, so lets assume that we restrict this to ELF format files only.

Basically the idea is, (I think...), we define a new section flag, eg:

  SHF_GNU_CAN_BE_STRIPPED

which would be set by the linker on any section that it believes is not
necessary for proper execution of the binary.  (ie debug info sections,
notes that are not needed by the loader, etc).  In addition tools like
objcopy should be able to add or remove this flag from specific 
sections at the behest of the user.

The purpose of the flag is to tell tools like strip and eu-strip that the
section can and should be removed or preserved when stripping or creating
a debuginfo file.  (At the moment this decision is made by heuristics
built into these tools, and the heuristics differ...)

In order to support backwards compatibility with files that do not use
this scheme, it will probably also be necessary to define a second flag:

  SHF_GNU_DO_NOT_STRIP

Then the tools can detect sections which have not been annotated with this
new feature and fall back on their old heuristics instead.

-------------------------------------------------------------------------

Does that sound about right ?  

If so then I think that the proper way to proceed with this idea is to
present it on the GNU gABI list (gnu-gabi@sourceware.org) rather than 
discussing it inside a binutils PR.  Do you agree ?

Cheers
  Nick

-- 
You are receiving this mail because:
You are on the CC list for the bug.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]