This is the mail archive of the binutils@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]

Prevent overflow for large MIPS binaries with TLS


A customer gave us a testcase today where the total number of GOT entries in
the primary GOT ended up being:
  global_gotno 16204
  tls_gotno 23
  local_gotno 219
  assigned_gotno 138

What this works out to is that if you add the GOT entries for global
symbols, TLS symbols, and local symbols (ignoring entries for
R_MIPS_GOT_PAGE), then you've got enough room.  But we overallocate for page
relocations because we can't easily predict how many will end up needed.
I tracked this down to the one place where we ignore the number of
potential local pages, yielding the attached (fairly obvious) patch.

OK?  Anyone want to double-check my logic on that?

-- 
Daniel Jacobowitz
CodeSourcery

2006-10-31  Daniel Jacobowitz  <dan@codesourcery.com>

	* elfxx-mips.c (mips_elf_merge_gots): Always use maxcnt.

Index: bfd/elfxx-mips.c
===================================================================
RCS file: /scratch/gcc/repos/src/src/bfd/elfxx-mips.c,v
retrieving revision 1.189
diff -u -p -r1.189 elfxx-mips.c
--- bfd/elfxx-mips.c	20 Oct 2006 07:59:44 -0000	1.189
+++ bfd/elfxx-mips.c	31 Oct 2006 23:12:22 -0000
@@ -3105,8 +3105,7 @@ mips_elf_merge_gots (void **bfd2got_, vo
   if (tcount > 0)
     {
       unsigned int primary_total = lcount + tcount + arg->global_count;
-      if (primary_total * MIPS_ELF_GOT_SIZE (bfd2got->bfd)
-	  >= MIPS_ELF_GOT_MAX_SIZE (arg->info))
+      if (primary_total > maxcnt)
 	too_many_for_tls = TRUE;
     }
 


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