Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 29 Sep 1998 23:58:09 -0600
From:      Warner Losh <imp@village.org>
To:        Chan Yiu Wah <c5666305@b1.hkstar.com>
Cc:        current@FreeBSD.ORG
Subject:   Re: what is the difference between aout & elf 
Message-ID:  <199809300558.XAA08268@harmony.village.org>
In-Reply-To: Your message of "Tue, 29 Sep 1998 12:19:12 %2B0800." <199809290419.MAA09433@b1.hkstar.com> 
References:  <199809290419.MAA09433@b1.hkstar.com>  

next in thread | previous in thread | raw e-mail | index | archive | help
In message <199809290419.MAA09433@b1.hkstar.com> Chan Yiu Wah writes:
: I am newbie to aout and elf format.  I would like to know there differences.
: Why FreeBSD is trying to go elf ?  I don't want to create flame. I just
: curious to know about that only. No Flame ,please.  

Back in the dim, dark past, there was simple hardware.  This simple
hardware supported a simple, small system.  a.out was completely
adequate for the job of representing binaries on this simple system (a
pdp-11).  As people ported unix from this simple system, they retained
the a.out format because it was sufficent for the early ports of unix
to thinks like the motorola 68k, VAXen, etc.

Then some bright hardware engineer desided that if he could force
software to do some sleezey tricks, then he'd be able to shave a few
gates off the design and allow his cpu core to run faster.  a.out was
ill-suited for this hardware, so many formats were used to get to a
better format.  Things like COFF, ECOFF, and a few obscure others were
invented and their limitations explored before things seemed to settle
on ELF.

In addition, program sizes were getting huge and disks were still
small so the concept of a shared library was born.  The VM system also
became more sophisticated.  In time, a.out wasn't up to handling these
problems.  In addition, people wanted to dynamically load things at
run time, or to junk parts of their program after the init code had
run to save in core memory and/or swap space.  Languages became more
sophistocated and people wanted code called before main
automatically.  Lots of hacks were done to the a.out format to allow
all of these things to happen, and they basically worked for a time.
While ELF solved many of these problems, it would be painful to switch
from the system that basically worked.

However, as time passed, the build tools that FreeBSD derived their
build tools from (the assembler and loader especially) evolved.  Many
people wanted to build cross compilers targeting FreeBSD, but the
older sources that FreeBSD had for as and ld weren't up to the task.
The new gnu tools chain (binutils) does support cross compiling, elf,
etc.  In addition, many vendors are releasing ELF binaries, and it is
a good thing for FreeBSD to run them.  And if it is running ELF
binaries, why bother having aout any more?  It is a tired old horse
that has proven useful for a long time, but it is time to turn him out
to pasture for his long, faithful years of service.

Elf is more expressive than a.out and will allow more extensibility in
the base system.  The elf tools are better maintained, and offer cross
compilation support, which is important to many people.  Elf is a
little slower than a.out, but trying to measure it can be difficult.
There are also numerous details that are different between the two in
how they map pages, handle init code, etc.  None of these are very
important, but they are differences.

I hope that this answers your question.

Warner


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199809300558.XAA08268>