ELF executable & relocatable

Mike Stump mrs@apple.com
Tue Jun 24 01:02:00 GMT 2003


On Friday, June 20, 2003, at 05:26 AM, S kris wrote:
> I have a very strange query? please clarify.
>
> I understand that the ELF executable binary in Linux is usually not 
> relocatable. So how to make or produce an ELF executable binary to be 
> relocatable? Eventually the image should be both executable and 
> relocatable, so that if binary in not loaded at its preferred load 
> address then it should be able to fixup the addresses using .reloc 
> section.

Two methods come to mind, preserve relocs into the code,  or PIC/PID.  
The first would be the domain of binutils (or whatever as/ld you're 
using), not gcc and not this list and the later would be the domain of 
the compiler.  pic is done and in the compiler, though, your port need 
not support it, and PID isn't, generally speaking.  That would be a new 
feature you'd have to implement.  If your port doesn't support pic, 
you'd have to add it, just see all the other pic ports for ideas on how 
to implement it.



More information about the Gcc mailing list