Subject: Re: dlopen() twists
To: Michael Richardson <mcr@sandelman.ottawa.on.ca>
From: Todd Vierling <tv@wasabisystems.com>
List: tech-userlevel
Date: 12/28/2000 11:33:10
On Thu, 28 Dec 2000, Michael Richardson wrote:

:     Todd> : > 	it seems to me that there are a couple of twists in dlopen() handling
:     Todd> : > 	in NetBSD.
:     Todd> : > 	1. static linked binaries cannot use dlopen().
:     Todd> :
:     Todd> : I think this is a mistake.
:
:     Todd> This is an artifact of the design of the [particularly ELF] dynamic loader.
:     Todd> For ELF, the kernel loads the ld.elf_so as the program interpreter *BEFORE*
:     Todd> the main program is completely set up to run.
:
:   understood.
:   isn't this just a question of providing libdl.a?

Not really.  Read up on the ELF ABI spec to understand why.

Now, it is *possible* to provide a libdl.a with some rewriting of the
code--but there are drawbacks, such as needing the shared libc for modules
that call libc functions (no, you can't get symbols from a main static
program), and other things.  The effort involved is likely more trouble than
it's worth.

-- 
-- Todd Vierling <tv@wasabisystems.com>  *  Wasabi NetBSD:  Run with it.
-- NetBSD 1.5 now available on CD-ROM  --  http://www.wasabisystems.com/