Mixing REL and RELA

Ian Lance Taylor ian@zembu.com
Thu Apr 15 14:21:00 GMT 1999


   From: hjl@lucon.org (H.J. Lu)
   Date: Thu, 15 Apr 1999 14:15:54 -0700 (PDT)

   > If REL works now, there is probably no reason to switch to RELA.  The
   > only reason I can think of would be if the compiler can gain an
   > advantage by splitting instructions which require relocations.  It is
   > sometime possible to make that work with REL instructions anyhow.
   > 
   > It would also be possible for the linker to support REL and RELA
   > relocations simultaneously, so there would be no need for a big
   > cutover.  We would just change gas to start generating RELA
   > relocations, and then after a while we could throw away the REL
   > support.
   > 
   > But I don't see a reason to do that if the code works now.

   Does the linker support mixing REL and RELA on any targets? How CPU
   depedent is this support? It may be useful to CPUs other than ARM.

I had this working at least for a little while for the 64 bit MIPS ELF
target, where the ABI from SGI requires it.  However, that target
never really worked, so I don't know how well mixing REL and RELA
works.

The support I wrote for MIPS is CPU dependent; the code is in
elf64-mips.c.  But I can't think of any reason why it has to be there.

Most relocation processing is CPU dependent anyhow, probably too much
so.

However, I would discourage mixing REL and RELA in object files.
That's just added complexity for no real benefit that I can see.

Ian



More information about the Bfd mailing list