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: Relocation sections in an ELF executable?


On Sat, Sep 11, 2004 at 09:32:06AM -0600, Chris Smith wrote:
> Good morning:
> 
> I need to be able to relocate pointer in an executable file from the runtime
> loader -- the executable is not placed at a fixed location on the platform I'm
> using.  However, I can't tell seem to tell from the ELF executable which
> variables are pointers and thus need to be relocated.
> 
> As far as I can tell, the exact information I need is stored in the .o files,
> in a section called .rel.text.  Is there an easy way to tell the linker to
> emit relocation sections into the executable output file, so that its contents
> can be used to fix up the binary in the runtime loader?

--emit-relocs (-q).  However, you're likely to encounter a lot of other
problems in that approach, for instance linker generated sections like
the PLT will often not have relocations.  You should take a look at PIE
(position independent executable) support, available in CVS.

-- 
Daniel Jacobowitz


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