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: .reloc improvement


On Mon, 22 Aug 2011, Alan Modra wrote:

> >  Please note that on REL MIPS targets local symbols have to be retained in 
> > several cases where crucial information is lost if a relocation against 
> > such a symbol is converted to one against the containing section's symbol.  
> > This applies to all the PC-relative relocations, where the relocatable 
> > field is too narrow to hold arbitrary addends, and also, more recently, to 
> > microMIPS targets, where linker relaxation has to know local symbol 
> > (label) addresses to perform branch displacement recalculations and to 
> > make the LUI/ADDIU->ADDIUPC relaxation.  The latter is a linker's internal 
> > limitation and may possibly be lifted (possibly by using the RELA 
> > representation internally even on REL targets), but the former is an 
> > inherent problem of the object file format used.
> > 
> >  Just making sure these issues are not missed -- I can't have a look at 
> > your change at the moment and see what exact implications it has, sorry.
> 
> The implication of my change is that the programmer will need to be
> careful in choosing symbols used with .reloc.  While that isn't ideal,
> .reloc is such a low-level interface that you need to know what you're
> doing if you use it.

 Problem is on REL targets some MIPS relocation types can never ever be 
safely converted to refer to a section symbol + addend instead of the 
intended symbol.  You'd therefore make .reloc useless for these types.

 Yes, REL shouldn't have been chosen for the MIPS ABI in the first place, 
with the complication observed here being the tip of an iceberg only, but 
there you go.  The choice was later fixed with the new ABIs made for 
64-bit MIPS processors, but the old ABI still remains for 32-bit ones.

> Alternatively, I'm quite willing to disable the symbol to section symbol 
> conversion for REL targets.

 Good idea, that sounds like a plan to me.  That could be made platform 
specific if that made anybody's life easier.

  Maciej


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