[2/20] MIPS GOT: Tweak the size estimate for the primary GOT

Richard Sandiford rdsandiford@googlemail.com
Mon Feb 11 17:25:00 GMT 2013


mips_elf_merge_got_with counts reloc-only global GOT entries when merging
with the primary GOT, but that's only necessary when the GOTs also have
TLS entries (which come after all globals).  mips_elf_merge_gots already
makes this distinction.

Later patches would cause testsuite failures without this.

Richard


bfd/
	* elfxx-mips.c (mips_elf_merge_got_with): Only use arg->global_count
	if there are TLS relocations.

Index: bfd/elfxx-mips.c
===================================================================
--- bfd/elfxx-mips.c	2013-02-11 14:06:30.264141655 +0000
+++ bfd/elfxx-mips.c	2013-02-11 14:06:30.786145692 +0000
@@ -4275,10 +4275,10 @@ mips_elf_merge_got_with (struct mips_elf
   estimate += from->local_gotno + to->local_gotno;
   estimate += from->tls_gotno + to->tls_gotno;
 
-  /* If we're merging with the primary got, we will always have
-     the full set of global entries.  Otherwise estimate those
+  /* If we're merging with the primary got, any TLS relocations will
+     come after the full set of global entries.  Otherwise estimate those
      conservatively as well.  */
-  if (to == arg->primary)
+  if (to == arg->primary && from->tls_gotno + to->tls_gotno)
     estimate += arg->global_count;
   else
     estimate += from->global_gotno + to->global_gotno;



More information about the Binutils mailing list