This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: relocations with addenda
- From: Nick Clifton <nickc at redhat dot com>
- To: Stuart Clarke <stuart_clarke at beeline dot ag>
- Cc: binutils <binutils at sources dot redhat dot com>, Corey Schuhen <corey_schuhen at beeline dot ag>
- Date: 23 Oct 2002 11:30:50 +0100
- Subject: Re: relocations with addenda
- References: <200210262210.55061.stuart_clarke@beeline.ag>
Hi Stuart,
> I am attempting to compile a simple program on my i386 machine for an ARM
> target. In doing this, GCC produces a relocation section in its output file
> (.rel.text). ld then produces a .rel.text segment in its output when run with
> the --emit-relocs option. This relocation section is of the no-addenda
> variety and is incompatible with the system on which I am attempting to run
> my program. Said system requires a .rela.text section for its relocations
> (i.e. one with addenda values).
>
> ld doesn't seem to have a run-time option for converting the .rel.text
> sections of its input to .rela.text sections in its output. Is there any way
> to enable such a conversion?
Unfortunately no. The ARM port of LD gas GAS use REL type relocations
which store the addend in the instruction. What you need is a port
that uses RELA relocations where the addend is stored in a separate
field in the relocation structure itself.
> Can one adjust or patch the source code to accomplish this?
This is possible, although it would probably take a lot of testing to
make sure that it was done correctly. Feel free to try however.
There are a lot of other ports of GAS and LD that use RELA type
relocations so you can look at these for examples of what needs to be
done.
Cheers
Nick