[binutils-gdb/binutils-2_32-branch] PowerPC gcc bootstrap fail with bss-plt

Alan Modra amodra@sourceware.org
Sat Aug 17 22:23:00 GMT 2019


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

commit 86bee50d3c32db6e626149525af6ab241705a1b4
Author: Alan Modra <amodra@gmail.com>
Date:   Fri Aug 16 13:20:28 2019 +0930

    PowerPC gcc bootstrap fail with bss-plt
    
    git commit 3e04d7655b introduced a bug by sizing output sections
    earlier in ppc_before_allocation.  That meant PLT (and GOT) sizes were
    not included when calculating total executable section sizes.
    
    	* emultempl/ppc32elf.em (ppc_before_allocation): Force running
    	prelim_size_sections before deciding whether branch trampolines
    	might be needed.
    
    (cherry picked from commit 7df6aecc97b96843da080d54414052b1c954ddca)

Diff:
---
 ld/ChangeLog             | 6 ++++++
 ld/emultempl/ppc32elf.em | 7 ++++++-
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/ld/ChangeLog b/ld/ChangeLog
index 0704764..a05684b 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,9 @@
+2019-08-16  Alan Modra  <amodra@gmail.com>
+
+	* emultempl/ppc32elf.em (ppc_before_allocation): Force running
+	prelim_size_sections before deciding whether branch trampolines
+	might be needed.
+
 2019-07-25  Srinath Parvathaneni  <srinath.parvathaneni@arm.com>
 
 	Backport from mainline
diff --git a/ld/emultempl/ppc32elf.em b/ld/emultempl/ppc32elf.em
index 77143e7..2e79175 100644
--- a/ld/emultempl/ppc32elf.em
+++ b/ld/emultempl/ppc32elf.em
@@ -171,7 +171,12 @@ ppc_before_allocation (void)
       bfd_vma high = 0;
       asection *o;
 
-      /* Run lang_size_sections (if not already done).  */
+      /* Run lang_size_sections even if already done, so as to pick
+	 up gld${EMULATION_NAME}_before_allocation sizing.  This
+	 matters when we have an executable bss plt which will
+	 typically be laid out near the end of the image, ie. worst
+	 case for branches at the start of .text.  */
+      expld.phase = lang_first_phase_enum;
       prelim_size_sections ();
 
       for (o = link_info.output_bfd->sections; o != NULL; o = o->next)



More information about the Binutils-cvs mailing list