[OpenBIOS] Multiple APIs for ELF file handling

Mark Cave-Ayland mark.cave-ayland at siriusit.co.uk
Sat Mar 20 17:55:13 CET 2010

Hi all,

I've spent some time today looking at the ELF loader code for each 
different architecture, and with a bit of work I believe that I can 
modify arch/sparc64/elfload.c so that it can be used across all 

Looking closer at the source, it can be seen that are actually two sets 
of ELF routines: one in arch/*/elfload.c, and another set in 
libopenbios/elfload.c which only appears to be used by the PPC code. 
I've already manage to refactor the SPARC64 code so it reuses (and also 
exposes) the same API for use with the PPC code, except with one 
exception: file handles.

In arch/*/elfload.c, the preferred method for using handles is to make 
use of the included loadfs.c methods which works with an implicit file 
handle (i.e. the file handle isn't passed into any of the functions). In 
contrast, the PPC code directly calls the *_io() API (see 
find_elf()/elf_readhdrs()) and so requires an explicit file handle to be 
passed into each function.

I'm currently leaning towards the PPC method, since loadfs.c seems to be 
such a lightweight wrapper that it hardly seems worth keeping. Can 
anyone see a reason to keep this before I go and rip it out?



Mark Cave-Ayland - Senior Technical Architect
PostgreSQL - PostGIS
Sirius Corporation plc - control through freedom
t: +44 870 608 0063

Sirius Labs: http://www.siriusit.co.uk/labs

More information about the OpenBIOS mailing list