This is the mail archive of the
mailing list for the binutils project.
[2/20] MIPS GOT: Tweak the size estimate for the primary GOT
- From: Richard Sandiford <rdsandiford at googlemail dot com>
- To: binutils at sourceware dot org
- Date: Mon, 11 Feb 2013 17:25:25 +0000
- Subject: [2/20] MIPS GOT: Tweak the size estimate for the primary GOT
- References: <email@example.com>
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.
* elfxx-mips.c (mips_elf_merge_got_with): Only use arg->global_count
if there are TLS relocations.
--- 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;
estimate += from->global_gotno + to->global_gotno;