public inbox for gnu-gabi@sourceware.org
 help / color / mirror / Atom feed
From: Jozef Lawrynowicz <jozef.l@mittosystems.com>
To: Carlos O'Donell <carlos@redhat.com>, Florian Weimer <fweimer@redhat.com>
Cc: gnu-gabi@sourceware.org
Subject: Re: [RFC] SHF_GNU_RETAIN ELF Section Flag
Date: Fri, 18 Sep 2020 11:00:46 +0100	[thread overview]
Message-ID: <20200918100046.r4c3qepxbccp7poc@jozef-acer-manjaro> (raw)
In-Reply-To: <20200916141345.wxae5ytkyybbpcec@jozef-acer-manjaro>

Hi,

Where do we stand on this proposal?

Unless we are trying to be protective of the remaining operating
system-specific section flag bits, I don't really see any downside to
going the route of SHF_GNU_RETAIN. It is very simple, the linker
implementation requires only one additional line of code, and the
definition precisely describes how the section should be treated.

SHF_GNU_RETAIN
  The link editor should not garbage collect the section if it is
  unused.

I don't think the extra detail about whether the link editor sees the
section or not (in the case of libraries) is actually needed.

The definition explicitly states exactly what the linker should do - do
not garbage collect the section. It does not say "the linker should keep
the section if it is unused". Garbage collection implies the linker
"had" the section to begin with.

Perhaps the ambiguity in this area comes from the word "retain" in the
flag name, but again this has a precise definition. You cannot retain
something you don't have. To use the word "encounters" which is used
throughout the ELF spec:

If the linker doesn't encounter a section, it can't retain it. The
linker doesn't encounter any sections from libraries until it loads
an object file needed to resolve a symbol reference, so this behavior is
also precisely defined by the above definition.

If we really need to, we could add emphasize the "garbage collection"
aspect further:

SHF_GNU_RETAIN
  When performing garbage collection of unused sections, the link editor
  should not discard the section, even if it appears unused.

Are there any other objections to adding this to the GNU gABI?

Thanks,
Jozef

  reply	other threads:[~2020-09-18 10:00 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-15 12:06 Jozef Lawrynowicz
2020-09-15 12:09 ` Florian Weimer
2020-09-15 12:31   ` Jozef Lawrynowicz
2020-09-15 12:37     ` Florian Weimer
2020-09-15 12:50       ` Carlos O'Donell
2020-09-15 12:55         ` Florian Weimer
2020-09-15 13:29           ` Jozef Lawrynowicz
2020-09-15 14:11             ` Carlos O'Donell
2020-09-15 16:52               ` Jozef Lawrynowicz
2020-09-16 12:58                 ` Carlos O'Donell
2020-09-16 13:11                 ` Florian Weimer
2020-09-16 13:46                   ` Michael Matz
2020-09-18 12:07                     ` Florian Weimer
2020-09-18 12:22                       ` Jozef Lawrynowicz
2020-09-18 18:09                         ` Florian Weimer
2020-09-16 14:13                   ` Jozef Lawrynowicz
2020-09-18 10:00                     ` Jozef Lawrynowicz [this message]
2020-09-18 18:11                       ` Florian Weimer
2020-09-21 12:42                         ` Michael Matz
2020-09-21 18:53                           ` Jozef Lawrynowicz

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=20200918100046.r4c3qepxbccp7poc@jozef-acer-manjaro \
    --to=jozef.l@mittosystems.com \
    --cc=carlos@redhat.com \
    --cc=fweimer@redhat.com \
    --cc=gnu-gabi@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).