ET_DYN flag in ELF header?

Paul Mackerras paulus at samba.org
Fri Nov 21 10:59:03 EST 2008


Yoder Stuart writes:

> The ePAPR specifies that for an ELF file with a header
> e_type value of ET_DYN, that the boot program can load
> a client program at an address of its chosing.
> 
> Question is how to set the ET_DYN flag in an ELF header?
> I haven't had the time to dig through the linker 
> documentation yet, but wondered if anyone has tried
> to do this yet, and if so, how you did it.

Link with -pie.  For 32-bit, you then need to make sure you process
the dynamic relocations at startup.  I posted a patch that links the
bootwrapper as a PIE some time back which you could use as an example
(look for the subject "[RFC PATCH] Link the bootwrapper as a
position-independent executable").  That relied on having the objects
compiled with -fPIC.  I'm working on a patch for a relocatable 32-bit
kernel that handles more relocations and doesn't require compiling
with -fPIC.  I'll post it shortly.

Paul.



More information about the devicetree-discuss mailing list