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]

Re: R_MIPS_TLS_GD reloc overflow when linking >=xulrunner-1.9.1.5


On 13:25 Tue 01 Jun     , Zhang Le wrote:
> 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.

I found this may caused by some error in estimating gotno when mering got's.
Haven't located the exact problem though.

But after changing the max_count in got_per_bfd_arg from 16377 to 12000,
all relocation overflows disappear.

Then I found 12639 is the largest allowable value.

Of course, this by no means would be the final solution.

I will go on investigating it.

-- 
Zhang, Le
Gentoo/Loongson Developer
http://zhangle.is-a-geek.org
0260 C902 B8F8 6506 6586 2B90 BC51 C808 1E4E 2973

Attachment: pgp00000.pgp
Description: PGP signature


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