[Talk] State of dynamic linking in various platforms...

Glenn Satchell Glenn.Satchell at uniq.com.au
Thu Aug 22 20:45:23 EST 2002


> 
> > On 2002-Aug-22 14:50:32 +1000, Michael Paddon <michael at paddon.org> wrote:
> > >Statically linked executables have several key advantages IMHO:
> > >   * faster (no run time linking necessary, but who cares with an n GHZ
> > >     processor)
> 
> On Thu, Aug 22, 2002 at 03:20:57PM +1000, Peter Jeremy wrote:

> > The "buy a faster processor and more disk space" approach leads to
> > abominations like WinBloze.
> 
> True, but the change in relative speeds and sizes does make a difference.
> When Solaris shared libraries first appeared there was a lot of debate
> about the extra memory required to map all the bits of the library you
> mightn't actually use, but as you add users/processes the sharing ratio
> goes up and soon you are using less memory overall.

With a virtual memory system you only copy the pages of the shared
object into memory as they are accessed, so if you have 1 MB and you
only use one function then there might be only a few pages read into
memory.
> 
> > There are also security implications - with a dynamically linked
> > executable, there can be a long chain of assorted libraries that
> > you wind up executing - each of which need to be protected (along
> > with all their parent inodes).  I think I once counted >20 inodes
> > accessed for a dynamically linked "hello world" on Solaris.
> 
> There's always a way for someone to stuff it up.

What about the opposite? A security issue in a library that is
statically linked means you have to rebuild every executable. With a
dynamic library you replace the so and the existing exe's pick up the fix.

> > > One of the really nice things about statically linked executables is that 
you 
> > > can whack them onto any system (which supports the correct kernel traps), 
> > > without worrying about having to get the right libraries. This makes add 
on 
> > > apps far less sensitive to the "right" version and makes binary emulation 
(say 
> > > a linux executable on a FreeBSD box) more of a sure thing.
> > > 
> > > It would be really nice if third party apps provided statically linked 
> > > versions, however, so that they can be easily run under emulation.

Yikes, what happens about fixes for library bugs? You may not even know
what OS or versions of libraries are linked into an application...

regards,
-glenn




More information about the Talk mailing list