]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
PowerPC64 .branch_lt size change leads to "stubs don't match calculated size"
authorAlan Modra <amodra@gmail.com>
Fri, 26 Jan 2018 01:55:09 +0000 (12:25 +1030)
committerAlan Modra <amodra@gmail.com>
Fri, 26 Jan 2018 05:22:31 +0000 (15:52 +1030)
commite1807cefd4c7dcadcdf54f200f751ba1930dba6a
tree6853ceb10a8a206b877d2d4cff0351aa6b36f287
parentdcfb97d4a29d7723ba0f1e27481a7135aa60460b
PowerPC64 .branch_lt size change leads to "stubs don't match calculated size"

https://bugzilla.redhat.com/show_bug.cgi?id=1523457

I haven't analyzed this myself, I'm relying on Nick's excellent
analysis.  What I believe is happening is that after some number of
stub sizing iterations, a long-branch stub needs to be converted to a
plt-branch, but either due to stub alignment or other stubs shrinking
in size, the stub group section size doesn't change.

That means we exit from ppc64_elf_size_stubs after sizing with an
incorrect layout, in fact the additional .branch_lt entry overlays
.got!  Since .TOC. is normally set to .got + 0x8000 the stub sizing
code decides that entry is within +/-32k of the TOC pointer and so a
three insn stub is sufficient.  When we come to build the stubs using
a correct non-overlaying layout, a four insn plt-branch stub is
generated and the stub group size doesn't match that calculated
earlier.

* elf64-ppc.c (ppc64_elf_size_stubs): Iterate sizing when
.branch_lt changes size.

(cherry picked from commit ba21f5646454c418e75eb06f6bf1a00a173641ca)
bfd/ChangeLog
bfd/elf64-ppc.c