ELF

From: Christopher Fraser <chrisf_at_nospam.org>
Date: Mon Dec 19 1994 - 18:32:09 PST

How do people feel about adpoting ELF as the "standard" executable
format in VSTa? ELF is file executable and linking format used in
SVR4. It's highly portable, very cool and entirely in the spirit
of the festive silly season.

Seriously though, adopting ELF seems like a Good Thing. If nothing
else it would most of the executable format handling code be machine
independent, but there are lots of other good reasons (I'd started
running into a.out limitations in my MIPS port, like no support
for multiple "small" and "big" data segments etc, and adding ELF
was much easier and more elegant than ECOFF).

Reading over the binutils-2.5.1 documentation makes me think that
it's quite stable on intel and sparc platforms (the Linux people
seem to be using it quite a lot). I haven't had any problems on
the MIPSen yet. I'm not sure about 68k.

Adding basic support for ELF format boot tasks to my R3000 port was an
afternoons work, most of which is (or could be) quite portable. To
support it properly would require some changes to the machine
independent code, namely making the boottask structure have a set
of mapseg like entries associated with it.

libc support would also be pretty easy. The machine dependent bit
should be limited to some header checks (architecture, endianess
etc). The only manditory change would be extending struct mapfile
to allow an arbitrary number of mappings.

A possible addition would be modifing mapseg to be something like:

        struct mapseg {
                void *m_vaddr; /* Vaddr to map at */
                uint m_off; /* Offset into file, in pages */
                uint m_memsz; /* memory size */
                uint m_filesz; /* file size */
                uint m_flags; /* See below */
        };

where if m_filesz < m_memsz the rest of the mapping is ZFOD, which
is how ELF represents such things. I would be tempted to keep the
prsent ZFOD-flag style interface and have the libc code work out
which bits of the mapping are ZFOD and which are demand paged and
do seperate mapseg entries for them.

Anyway, if you're interested there's a copy of the ELF spec at:

        ftp://ftp.intel.com/pub/tis/elf11g.zip

(at least, I think elf11g.zip is file we have here). An earlier
version of this also appears in the the SVR4 Programmer's Guide:
ANSI C and Programming Support Tools.

ELF has its own hooks for dynamic linking, but I'm not really sure
how they work.

I'd be interested in hearing about anyone else's experiences with ELF.
I really only been using it for a week so it's probably a little
pemature for me to be calling it th best thing since one-pass
linking. None-the-less, it appears to be an extremely well thought-out
format and was reasonably trivial to implement.
 
Cheers,

Christopher.
Received on Mon Dec 19 18:04:17 1994

This archive was generated by hypermail 2.1.8 : Thu Sep 22 2005 - 15:12:11 PDT