]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
PR20886, looping in ppc64_elf_size_stubs
authorAlan Modra <amodra@gmail.com>
Wed, 30 Nov 2016 05:03:07 +0000 (15:33 +1030)
committerAlan Modra <amodra@gmail.com>
Wed, 30 Nov 2016 06:33:51 +0000 (17:03 +1030)
The PR20886 binary is large enough that there are two stub sections
servicing .text (which is 88M).  It so happens that between one
iteration of sizing and the next that one stub section grows while
the other shrinks.  Since one section is always growing, the loop
never terminates.

This patch changes the algorithm to not update previous size on
shrinking, once we go past a certain number of iterations.

PR ld/20886
* elf64-ppc.c (ppc64_elf_size_stubs): Make rawsize max size seen
on any pass past STUB_SHRINK_ITER.

bfd/ChangeLog
bfd/elf64-ppc.c

index 2eb6f2af740a35d5020bf959a8c51c85281b33f9..d8b13c833cbff534ca53f43d5abe404e0d8a7830 100644 (file)
@@ -1,3 +1,9 @@
+2016-11-30  Alan Modra  <amodra@gmail.com>
+
+       PR ld/20886
+       * elf64-ppc.c (ppc64_elf_size_stubs): Make rawsize max size seen
+       on any pass past STUB_SHRINK_ITER.
+
 2016-10-31  Alan Modra  <amodra@gmail.com>
 
        PR 20748
index d2367327f0eaa19709990e22cf42df7b7f460100..8bebdec69ac589da016eeaccb52c7260377e377c 100644 (file)
@@ -12540,7 +12540,10 @@ ppc64_elf_size_stubs (struct bfd_link_info *info)
           stub_sec = stub_sec->next)
        if ((stub_sec->flags & SEC_LINKER_CREATED) == 0)
          {
-           stub_sec->rawsize = stub_sec->size;
+           if (htab->stub_iteration <= STUB_SHRINK_ITER
+               || stub_sec->rawsize < stub_sec->size)
+             /* Past STUB_SHRINK_ITER, rawsize is the max size seen.  */
+             stub_sec->rawsize = stub_sec->size;
            stub_sec->size = 0;
            stub_sec->reloc_count = 0;
            stub_sec->flags &= ~SEC_RELOC;