REL vs. RELA: how to choose?

Alan Modra alan@linuxcare.com.au
Wed Feb 14 16:26:00 GMT 2001


On Wed, 14 Feb 2001, Greg McGary wrote:

> What are the processor-architecture features that might make one or
> the other of REL vs. RELA necessary or more convenient?  This has been
> a nagging question for some time now.

REL is a bad choice for architectures that store values in instructions in
odd ways.  eg. parisc branch insn looks like

|         |  w1   |        |   w2    |       |  w    |
| 11 bits | 5 bit | 3 bits | 11 bits | 1 bit | 1 bit |

with the actual offset being calculated as
sign_extend ((w << 16) | (w1 << 10) | ((w2 & 1) << 9) | (w2 >> 1)) << 2
or something like that.

Can you imagine the hoops the linker would have to go through dealing with
relocations for a REL parisc object file?

REL is also bad because it complicates overflow checking in the linker as
it's typically not possible to store a full address in the instruction.

RELA is nearly always the better choice, except where smaller object file
size is very important.  What's the price of 40G disks today?

Alan Modra
-- 
Linuxcare.  Support for the Revolution.




More information about the Binutils mailing list