public inbox for gnu-gabi@sourceware.org
 help / color / mirror / Atom feed
From: Michael Matz <matz@suse.de>
To: Nick Clifton <nickc@redhat.com>
Cc: gnu-gabi@sourceware.org,
	 "Guillermo E. Martinez" <guillermo.e.martinez@oracle.com>
Subject: Re: Using section flags to indicate stripable or persistent sections
Date: Mon, 7 Nov 2022 13:33:53 +0000 (UTC)	[thread overview]
Message-ID: <alpine.LSU.2.20.2211071320320.29399@wotan.suse.de> (raw)
In-Reply-To: <ea85186f-e16c-89ee-d5d6-fb865c3e082d@redhat.com>

Hey,

On Mon, 7 Nov 2022, Nick Clifton via Gnu-gabi wrote:

>     We would like to suggest an extension the ELF section flags which can be
>     used to indicate sections that should, or should not, be stripped when
>     removing debug information.

Okay, so stripping of sections intended for debug purposes ...

>     The problem we are trying to address is that different stripping tools
>     (strip, eu-strip, llvm-strip) have different heuristics for deciding
>     which sections should be removed when stripping debug information.  In
>     order to fix this we are proposing two new section flags:
> 
>       GNU_SHF_CAN_BE_STRIPPED
>       GNU_SHF_DO_NOT_STRIP

... but here you have "can be stripped?".  The immediate question is: for 
which purposes?  A section might be strippable in other context than debug 
info.  And other sections might be non-strippable for still other 
purposes.  Just saying "please don't strip this one" conveys no useful 
information, except of course to inhibit each and all stripping.  But was 
it perhaps set for other reasons than debug info?  Even with those flags 
tools will continue to wonder if maybe this-and-that DO_NOT_STRIP option 
can actually be stripped in some cases.

IOW: if you really want what you said, make the flags more specific (to 
debug info purposes).  But then of course it's unclear why you wouldn't 
want still other flags to mean "strip-for-something-else" purposes.  At 
which point you quickly come to the conclusion that one wants to specify 
some sort of type per section, and not lump everything under SHT_PROGBITS.

So, I think two flag bits are not the right solution.  Maybe we could use 
some bits of sh_type to specify a more detailed type: the low bits would 
just be set to the ELF SHT_xxx as appropriate, and higher bits would 
contain a detailed type:

  0x60XXYYZZ

(ZZ would be the old SHT_xxx type, and XX/YY be a detail type).


Ciao,
Michael.

> 
>     These would be set by the assembler and/or linker to indicate sections
>     that should be removed when stripping and sections which must not be
>     removed when stripping.  It would be an error if both flags were present
>     on a given section, and if neither flag is present then the stripping
>     tool would fall back on its built in heuristics.
> 
>     In addition we need new flags for the assembler's .section directive
>     (suggestion: 'D': can be stripped, 'K' do not strip).
>     This email is to ask if you think that this idea has merit, and if so,
>     are there any guidelines for writing and submitting a formal specification
> ?
> 
>  Cheers
>     Nick
> 

  reply	other threads:[~2022-11-07 13:33 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-07 11:22 Nick Clifton
2022-11-07 13:33 ` Michael Matz [this message]
2022-11-07 18:51   ` Fangrui Song
2022-11-07 23:07     ` Alan Modra
2022-11-09 11:09       ` Nick Clifton

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=alpine.LSU.2.20.2211071320320.29399@wotan.suse.de \
    --to=matz@suse.de \
    --cc=gnu-gabi@sourceware.org \
    --cc=guillermo.e.martinez@oracle.com \
    --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).