This is the mail archive of the binutils-cvs@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[binutils-gdb/binutils-2_27-branch] PR20886, looping in ppc64_elf_size_stubs


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=5d1f2ede8f0de48b90fd18a81f67382dc99661dc

commit 5d1f2ede8f0de48b90fd18a81f67382dc99661dc
Author: Alan Modra <amodra@gmail.com>
Date:   Wed Nov 30 15:33:07 2016 +1030

    PR20886, looping in ppc64_elf_size_stubs
    
    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.

Diff:
---
 bfd/ChangeLog   | 6 ++++++
 bfd/elf64-ppc.c | 5 ++++-
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 2eb6f2a..d8b13c8 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -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
diff --git a/bfd/elf64-ppc.c b/bfd/elf64-ppc.c
index d236732..8bebdec 100644
--- a/bfd/elf64-ppc.c
+++ b/bfd/elf64-ppc.c
@@ -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;


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]