R_MIPS_TLS_GD reloc overflow when linking >=xulrunner-1.9.1.5

Zhang Le r0bertz@gentoo.org
Tue Jun 1 05:26:00 GMT 2010


On 01:24 Mon 21 Dec     , Zhang Le wrote:
> I made some progress, found where the problem happens:
> 
> (gdb) info b
> Num     Type           Disp Enb Address    What
> 2       breakpoint     keep y   0x2ab390cc in mips_elf_calculate_relocation at elfxx-mips.c:5094
>         stop only if r_type==R_MIPS_TLS_GD
>         breakpoint already hit 2 times
> 
> return value:
> 5164              g = mips_elf_local_got_index (abfd, input_bfd, info,
>     Value returned is $17 = 73452

This problem still exists for xulrunner-1.9.3_alpha5 and binutils from cvs
(checked out today).

I found that the index's value is assigned here:

  next_index = MIPS_ELF_GOT_SIZE (entry->abfd) * (long) g->tls_assigned_gotno;

in mips_elf_initialize_tls_index().

And the g->tls_assigned_gotno is assigned here:

      g->tls_assigned_gotno = g->local_gotno + g->global_gotno;

in mips_elf_multi_got().

In one of those overflows:
  global_gotno = 0x1239
  local_gotno = 0x3c3b
So
  tls_assigned_gotno = 0x4e74

And the next_index is 0x4e74 * 4 = 80336, which is higher than 2**16.
And thus overflow.

However I still haven't found out why the local_gotno and global_gotno is so
high and how to make them not so high.

-- 
Zhang, Le
Gentoo/Loongson Developer
http://zhangle.is-a-geek.org
0260 C902 B8F8 6506 6586 2B90 BC51 C808 1E4E 2973
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20100601/93ef2beb/attachment.sig>


More information about the Binutils mailing list