This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: Relocation sections in an ELF executable?
- From: Daniel Jacobowitz <drow at false dot org>
- To: Chris Smith <cdsmith at twu dot net>
- Cc: binutils at sources dot redhat dot com
- Date: Sat, 11 Sep 2004 11:34:05 -0400
- Subject: Re: Relocation sections in an ELF executable?
- References: <09fe01c49814$7ef415f0$6f00000a@KYA>
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