This is the mail archive of the binutils@sources.redhat.com 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: relocations with addenda


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


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