Subject: Re: HEADS UP: migration to fully dynamic linked "base" system
To: David Laight <david@l8s.co.uk>
From: Johnny Billquist <bqt@update.uu.se>
List: current-users
Date: 08/27/2002 14:07:45
On Tue, 27 Aug 2002, David Laight wrote:

> > The problem is (correct me if I'm wrong) that we get problems since
> > dynamically loaded stuff might want to load yet other dynamic stuff, which
> > might conflict with the static linked stuff.
> 
> An issue - but unlikely for stuff in /bin since the netbsd build
> process will have rebuilt it at the same time as libc.a and libc.so.

Yes, but suppose then that /bin/ls dlopen() some other stuff, which in
turn wants to access stuff in libc, and the thing dlopen():en is from an
older build. It can then refer to an older version of libc than the one
you statically linked in.

> > But how is this resolved in a dynamic linked binary? The same thing can
> > obviously happen there. You can have two libraries loaded, which both
> > refer to a third library in turn, and they want different versions of that
> > third library.
> 
> It depends on how they open the 'third' library.  If they have a 'NEEDED'
> entry for it then the library symbols will be added to the programs
> symbol table and (probably) first one (which may be in the program
> itself) used in all cases.

Okay. So we really are in this shit already. Oh, in that case I can't
really see why we don't add dlopen() to the static library and just go for
it.

> > So what we need for static linking to work is that dlopen needs to know
> > the versions of the statically linked libraries, and make the same checks
> > as usual.
> 
> No you can't do static linking [1] and dlopen(), but you can link an
> archive library into a dynamically linked program.

We already went over this. Yes, dlopen() is not available to static linked
binaries today. *That* is what I'm talking about. Let's add it.
There is nothing (by the hand of god) that prevents you from having the
same code as ld.so (and then dlopen()) included in a static library.

	Johnny

Johnny Billquist                  || "I'm on a bus
                                  ||  on a psychedelic trip
email: bqt@update.uu.se           ||  Reading murder books
pdp is alive!                     ||  tryin' to stay hip" - B. Idol