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: Why relocation truncated to fit: R_MIPS_26 again `memcpy'?


Excerpt of message (sent 12 June 2009) by Adam Nemet:
> Hi Nick,
> 
> Nick Clifton <nickc@redhat.com> writes:
> 
> > Hi Pan,
> >
> >> test.c:(.text+0x64): relocation truncated to fit: R_MIPS_26 against `memcpy'
> >
> >> 80000628 T memcpy
> >
> >> Since .text section and memcpy are located in the same 256M region,
> >> how the `relocation truncated to fit' linking error comes?
> >
> > The R_MIPS_26 relocation is not PC-relative.  Therefore it is trying to put
> > the address of the memcpy symbol into a 26-bit wide field.  Since the address
> > is 0x80000628 the value will not fit and you get the error message above.
> 
> It is PC-relative, in terms of the current 256M segment the relocation
> (i.e. the direct jump instruction) is in.

Yup.

So a jump from x to y is valid whenever (x>>26) == (y >> 26) and out
of range otherwise.  

It seems to work right for me...

   paul


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