From: Michael Matz <matz@suse.de>
To: Alan Modra <amodra@gmail.com>
Cc: binutils@sourceware.org
Subject: Re: [PATCH 4/8] section-select: Completely rebuild matches
Date: Tue, 29 Nov 2022 13:23:18 +0000 (UTC) [thread overview]
Message-ID: <alpine.LSU.2.20.2211291318230.24878@wotan.suse.de> (raw)
In-Reply-To: <Y4X5edG0UYpacY/w@squeak.grove.modra.org>
Hey,
On Tue, 29 Nov 2022, Alan Modra wrote:
> > > That's a problem. The got header is created in the .got of "linker
> > > stubs", and code setting the value of .TOC. assumes that the header
> > > will be located first in the .got output section. This ties in with
> > > where ld.so expects to find the header too.
> >
> > I see. But then why is the testcase (and linker script?) not using
> >
> > .got { *(.got) *(.toc) }
> >
> > ? The way it's written right now means "for each file, first its .got
> > then its .toc, intermixed", i.e. file1.got, file1.toc, file2.got,
> > file2.toc ...
>
> Yes. That's the way we want it. When linking small model code with a
> total GOT/TOC of over 64k, the linker splits the TOC into multiple
> pieces with r2 adjusting stubs inserted on calls between files that
> use different pieces of the TOC. That scheme wouldn't work if a
> file's .got entries were placed in a different piece of the TOC to the
> file's .toc entries.
Ah, nifty. Something like that occurred to me yesterday as well, and
either way, rewriting the linker script like above wouldn't have helped
this problem anyway, as long as "linker stubs".got would have been created
late it would always have been placed at the end of the list.
Although one could pedantically argue that those late-created sections
being placed at the end would indeed conform to "as they are found in the
linker input", I won't belabor that point. Complete rebuilding it is,
performance-wise it's a wash :)
Ciao,
Michael.
next prev parent reply other threads:[~2022-11-29 13:23 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <cover.1669391757.git.matz@suse.de>
2022-11-25 16:44 ` [PATCH 1/8] section-select: Lazily resolve section matches Michael Matz
2022-11-25 16:46 ` [PATCH 2/8] section-select: Deal with sections added late Michael Matz
2022-11-25 16:47 ` [PATCH 3/8] section-select: Implement a prefix-tree Michael Matz
2022-11-25 16:55 ` [PATCH 4/8] section-select: Completely rebuild matches Michael Matz
2022-11-28 1:57 ` Alan Modra
2022-11-28 14:24 ` Michael Matz
2022-11-29 12:22 ` Alan Modra
2022-11-29 13:23 ` Michael Matz [this message]
2022-11-25 16:55 ` [PATCH 5/8] section-select: Remove unused code Michael Matz
2022-11-25 16:55 ` [PATCH 6/8] section-select: Cleanup Michael Matz
2022-11-25 16:57 ` [PATCH 7/8] section-select: Remove bfd_max_section_id again Michael Matz
2022-11-25 16:58 ` [PATCH 8/8] section-select: Fix exclude-file-3 Michael Matz
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.2211291318230.24878@wotan.suse.de \
--to=matz@suse.de \
--cc=amodra@gmail.com \
--cc=binutils@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).