bfd/
authorRichard Sandiford <rdsandiford@googlemail.com>
Mon, 11 Feb 2013 17:25:23 +0000 (17:25 +0000)
committerRichard Sandiford <rdsandiford@googlemail.com>
Mon, 11 Feb 2013 17:25:23 +0000 (17:25 +0000)
* elfxx-mips.c (mips_elf_merge_got_with): Only use arg->global_count
if there are TLS relocations.

bfd/ChangeLog
bfd/elfxx-mips.c

index 79c410227afa4e50953dd36008af283688839580..be33a47542504db5f582e7231a5a0c57bb2c3b06 100644 (file)
@@ -1,3 +1,8 @@
+2013-02-11  Richard Sandiford  <rdsandiford@googlemail.com>
+
+       * elfxx-mips.c (mips_elf_merge_got_with): Only use arg->global_count
+       if there are TLS relocations.
+
 2013-02-11  Richard Sandiford  <rdsandiford@googlemail.com>
 
        * elfxx-mips.c (mips_elf_recreate_got): Remove free.
index 9a92e2dd2cb51fb4c84fbbb43258318b399368fe..abf2156dc52bf64d07c6c7bfa8af27b42b0e6f78 100644 (file)
@@ -4275,10 +4275,10 @@ mips_elf_merge_got_with (struct mips_elf_bfd2got_hash *bfd2got,
   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;