*BSD News Article 38138


Return to BSD News archive

Xref: sserve comp.os.386bsd.questions:14570 comp.os.linux.misc:30070
Newsgroups: comp.os.386bsd.questions,comp.os.linux.misc
Path: sserve!newshost.anu.edu.au!harbinger.cc.monash.edu.au!msuinfo!agate!howland.reston.ans.net!pipex!uunet!news.cygnus.com!kithrup.com!sef
From: sef@kithrup.com (Sean Eric Fagan)
Subject: Re: ELF and dynamic loading (Re: 386BSD vs Linux)
Organization: Kithrup Enterprises, Ltd.
Message-ID: <CzJ6p3.7Gv@kithrup.com>
References: <3ag7cn$lba@pdq.coe.montana.edu> <3ai3oc$ffm@news.nynexst.com> <3albdp$rcf@pdq.coe.montana.edu>
Date: Sat, 19 Nov 1994 20:10:15 GMT
Lines: 35

In article <3albdp$rcf@pdq.coe.montana.edu>,
Nate Williams <nate@bsd.coe.montana.edu> wrote:
>What does ELF buy me (generic non-shlib
>implementor) that the current implementation in FreeBSD doesn't have?

Not a whole lot, really.  Except that it is, in lots of ways, "better" for
the developers, which means the compiler, linker, and OS writers, which
generally means that the end-user and third-party developers reap quite a
lot of benefits.

>The ELF shlib implementation is probably orders of magnitude easier to
>use than the old Linux implementation, but easy to use shared libraries
>have been the norm in the BSD's.

The current *bsd shared libraries are not so easy-to-use.

Try running a NetBSD shared binary on a FreeBSD system, or vice versa.  It
can easily not work, because of differences in the shared libraries, and the
fact that both are descended from the same version, so they're too similar.

If each binary is identifiable as a NetBSD or FreeBSD binary, then, with
ELF, the kernel can use different shared linkers.  In the current, a.out
scheme, crt0 loads /usr/libexec/ld.so explicitly; with ELF, the kernels sees
that the executable wants an "interpreter" of /usr/libexec/ld.so, and supposedly
loads that -- but it can do anything it *wants* with that.  It could, for
example, load in /usr/libexec/netbsd-ld.so, which would know to look in
/usr/lib/netbsd for all of the shared libraries it wants, instead of
/usr/lib.

ELF is also a bit more sane about offsets and whatnot, and all of the
various things that were done for AMAGIC and ZMAGIC etc. wouldn't've been
necessary with ELF (or COFF for that matter), as it has fields that specify
the offset into the file as well as another one to specify the starting
address of the program.  ELF is a lot better than COFF in that respect.