This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
RE: Relocating an ELF file
- From: andre_hauser at hsgmed dot com
- To: jakub at redhat dot com
- Cc: binutils at sources dot redhat dot com
- Date: Tue, 11 Jun 2002 10:28:01 +0200
- Subject: RE: Relocating an ELF file
Hi Jakub,
thanks for your response!
> -----Original Message-----
> From: Jakub Jelinek [mailto:jakub@redhat.com]
> Sent: Friday, June 07, 2002 3:12 PM
> To: andre_hauser@hsgmed.com
> Cc: binutils@sources.redhat.com
> Subject: Re: Relocating an ELF file
>
>
> On Fri, Jun 07, 2002 at 03:03:02PM +0200,
> andre_hauser@hsgmed.com wrote:
> > I've the following situation.
> >
> > An ELF file including program header, section info, symbols
> and relocation
> > tables has to be relocated, i.e. a section has to be moved
> to another memory
> > location and all relocatable references from other sections
> have to be
> > adapted.
>
> Is it a shared library or binary?
Actually the ELF file is an executable but still contains all relevant
relocation sections. The ELF file is being generated by a different
compiler, not gcc, for an embedded target.
Well, as I wrote before I tried to use bfd functions to relocate
some sections to different base addresses without success.
Any idea on which steps have to be done using bfd to relocate a
specific section?
Andre
> Unless you link with --emit-reloc, there is IMHO no way to do this for
> binaries as you loose a lot of information for that during the link.
> Shared libraries are doable quite easily, e.g. with prelink
> -r 0xsomeaddr somedso.so
> But the code to do all that in prelink is not very short and doing it
> in bfd framework would be even harder (prelink uses libelf).
>
> Jakub
>