In article <[EMAIL PROTECTED]>,
Brian F. Feldman <[EMAIL PROTECTED]> wrote:
> 
> Mind pointing me to the technical reason why (I'm sure you've explained
> it before) we can't use the dl* calls in any way without linking
> against ld-elf.so.1? I mean, have them in libc, for instance...

The versions in libc are just stubs.  Take a look at
"src/lib/libc/gen/dlfcn.c".  The implementations are in the dynamic
linker.

> One option I don't think anyone's brought up: why don't we _just_
> have ld-elf.so.1 in the root, but not libraries? That way, we
> don't bloat root excessively, but we can let people depend on
> being able to build -static/-Bstatic binaries that make everything
> static except the rtld? And modify gcc/ld to have static link with
> the rtld, so we have the benefit of those calls, can have static
> binaries still, and be able to depend on having an rtld (even for
> single-user mode.)

I think you have some misconceptions about how it all fits together.
Executables aren't "linked with" the dynamic linker.  It's a
separate shared object that is loaded directly by the kernel.  It
gets control before the main executable gets control.  Look at
"src/sys/kern/imgact_elf.c" and at the dynamic linker.

Also, programs that are linked (at "ld" time) with dynamic libraries
are different from programs that are linked with static libraries.
I.e., "ld" does very different things in the two cases.  You can't
take a statically-linked program and suddenly decide to treat it as
dynamically-linked at runtime.  It's too late at that point.

Finally, shared "libraries" aren't really libraries at all in the
traditional sense.  They're monolithic whereas traditional archive
libraries are made up of separate object files which are subsetted by
the linker.

To really understand the issues I think it's necessary to read through
the dynamic linker sources and understand what it's doing.  There used
to be books that described how it all worked (Prentice-Hall "System V
Application Binary Interface"), but as far as I know they're out of
print now.

John
-- 
  John Polstra                                               [EMAIL PROTECTED]
  John D. Polstra & Co., Inc.                        Seattle, Washington USA
  "No matter how cynical I get, I just can't keep up."        -- Nora Ephron


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message

Reply via email to