[PATCH 4/8] section-select: Completely rebuild matches
Michael Matz
matz@suse.de
Mon Nov 28 14:24:30 GMT 2022
Hello,
On Mon, 28 Nov 2022, Alan Modra wrote:
> On Fri, Nov 25, 2022 at 04:55:12PM +0000, Michael Matz via Binutils wrote:
> > this resets all section matches before updating for newly created
> > sections (i.e. completely rebuilds the matches). This fixes powerpc
> > "TOC opt" tests that shows a difference in section order: originally
> > .got of "linker stubs" comes before .toc (both placed into the same
> > .got output section due to ".got {*(.got .toc)}". But .got of linker
> > stubs is created later, and in the second run of resolve_wilds is
> > appended to the list, hence is then coming after .toc (which was added
> > already in the earlier resolve_wilds run). So order swapped ->
> > test fails.
>
> 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 ... And it seems a bit fuzzy to speak about "files" for the
artificial generated pseudo files like "linker stubs".
(Just to be clear: rebuilding all matches also solves this problem)
Ciao,
Michael.
More information about the Binutils
mailing list