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: Multiple relocation in ELF


David Daney <ddaney@avtrex.com> writes:

> Ian Lance Taylor wrote:
> > Michael Eager <eager@eagercon.com> writes:
> >
> >>Can you give an example of how this might be done?  I don't think that
> >>it is possible to apply two relocations to a single location in ELF.
> > You need to write the relocation semantics so that it will work.  It
> > won't work in general.
> > The 64-bit MIPS ABI is an example of a processor supplement which
> > applies multiple relocations to a single address.  However, it does it
> > in a different way, by changing the reloc format.
> >
> 
> Just a couple of days ago on gcc@gcc.gnu.org, this very point came
> up. It turns out that generating jump tables for case statements is
> one place where this could be of use.  If the jump table is in a
> different section than the code, you might need relocations to
> evaluate the distance between two symbols.

Note that you can always do a jump table using a PC relative
relocation against a single symbol, plus an addend.  However, I agree
that in some cases it can be useful to be able to have a relocation
which represents the difference between two symbols.  I do question
whether it is ever useful to have a relocation which represents the
sum of two symbols.

Ian


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