[Skiboot] [PATCH] Load ELF64 binaries correctly

Stewart Smith stewart at linux.vnet.ibm.com
Wed Jan 28 11:58:28 AEDT 2015

Nathan Whitehorn <nwhitehorn at freebsd.org> writes:
> On 01/27/15 09:59, Nathan Whitehorn wrote:
>> On 01/22/15 09:02, Benjamin Herrenschmidt wrote:
>>> On Wed, 2015-01-21 at 08:45 -0800, Nathan Whitehorn wrote:
>>>> The attached patch fixes the big-endian ELF64 loader in skiboot to
>>>> handle the fact that the ELF entry point is specified to point to a
>>>> function descriptor describing the entry point rather than the entry
>>>> point itself. (I haven't set it up to load the TOC base pointer though)
>>>> This is required to load the FreeBSD kernel as a skiboot payload. The
>>>> patch does not touch the little-endian loader since I'm not sure if the
>>>> ELFv2 spec still has function descriptors or not.
>>> An additional problem is that the Linux 64-bit BE kernel vmlinux doesn't
>>> have a correct function descriptor as an entry point :-( So that patch
>>> breaks loading a raw BE vmlinux... We probably need a quirk to recognize
>>> such an image, possibly via the fact that the value that would be in the
>>> function descriptor cannot possibly be a valid entry point as part of
>>> the image.
>> Here's a second version of the patch that can load both Linux and 
>> FreeBSD. It iterates through the ELF section table and, if the entry 
>> point points to an executable section, treats the entry point as the 
>> first instruction to run. Otherwise, it treats it as a function 
>> descriptor.

Cool. I'll let Ben do some ack/review on it.

It'd be great if you could resend with a Signed-off-by line (we follow
Signed-off-by etc just like linux kernel does), that'd be great!

More information about the Skiboot mailing list