Relocating an ELF file

Jakub Jelinek jakub@redhat.com
Fri Jun 7 06:11:00 GMT 2002


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?
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



More information about the Binutils mailing list