public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Andrew Burgess <aburgess@redhat.com>
To: Jan Beulich <jbeulich@suse.com>, Binutils <binutils@sourceware.org>
Subject: Re: ld's --orphan-handling vs empty linker-generated sections
Date: Wed, 02 Mar 2022 16:57:39 +0000	[thread overview]
Message-ID: <87v8wwxpfg.fsf@redhat.com> (raw)
In-Reply-To: <dfbf9d84-5cf1-93c5-4ffa-3987230e6aa6@suse.com>

Jan Beulich via Binutils <binutils@sourceware.org> writes:

> Hello,
>
> we've been considering to make use of this command line option to
> trigger warnings during the building of Xen. I'm puzzled though by
> the warning being issued for certain linker generated (as per the
> sections' flags) sections.
>
> For one there's .got, .plt, and alike. When building OS-kernel-like
> binaries, these are often expected (or even required) to be empty.
> Hence I would have thought there shouldn't be a need to name these
> in the linker scripts, but I don't see how else I could silence the
> resulting warnings.
>
> The other yet more puzzling set are various .rela.* sections. I
> can't even derive on what basis these are made. For example I see
> one for .text and .data.rel.local, but none for .data. No
> relocations are to remain anyway (we're not asking for them to be
> retained), so their origin is quite unclear to me. I do note though
> that the various scripts under ld/scripttempl/ indeed mention them.
> I have to admit that I wasn't aware these need mentioning; I was
> rather expecting they would be like e.g. .symtab and .strtab, which
> also aren't explicitly named.
>
> My first thought was to simply suppress the warning for empty linker
> generated sections in ldlang_place_orphan(). But it looks like final
> section sizes aren't known yet at that point, so "emptiness" cannot
> be determined at this point. Most sections are still empty at that
> time (but may not be in the end), while at least for x86-64 .got.plt
> isn't empty at this point, yet doesn't appear in the final binary.
>
> I would appreciate any insight here as well as hints towards the
> "canonical" silencing of this diagnostic. Having to enumerate all
> sections the linker might instantiate (and then drop again from the
> output for being empty) doesn't really work well, after all. As soon
> as new ones appear, one would need to fiddle with linker scripts
> again.

Just for context, when I originally proposed this flag, I was working on
smaller embedded targets for which .plt, .got, etc were not an issue.
As a result, I never really considered how these might be handled.

It's possible something has been added between then and now, but, it
might also be the case that there is no "canonical" solution for what
you want, you may have to invent one!

Good luck,
Andrew


      reply	other threads:[~2022-03-02 16:57 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-02 10:18 Jan Beulich
2022-03-02 16:57 ` Andrew Burgess [this message]

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=87v8wwxpfg.fsf@redhat.com \
    --to=aburgess@redhat.com \
    --cc=binutils@sourceware.org \
    --cc=jbeulich@suse.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).