That assumes it is possible for all future versions of said library to
maintain the exact same entry points, which is highly unlikely unless
all the entry points are in a table containing nothing but jumps to the
actual function addresses, which is what shared _dynamic_ libraries
evolve into after run-time relocation anyway.
My vague recollection -- and it is admittedly pretty vague -- is that
the net effect was that there was such a table, but that you ended up
with one less jump per call into the library post-relocation, and you
also ended up skipping a fairly significant hunk of relocations at
startup. So the cost was quite noticeable.
I found a page with a little more info:
http://www.pix.net/software/bsdos/elf_faq.html
The relevant hunk:
(As a test, I built the cat program as a dynamically linked
program (4777 bytes), as a statically linked program with
shared libraries (2437 bytes), and as a statically linked
program without shared libraries (50736 bytes). I ran `cat
/etc/fstab' and counted the number of instructions executed
using ptrace() since it's hard to measure run-times for
such small runs. The dynamically linked version used 300181
instructions; the static shared version used 2015 instructions;
and the static unshared version used 1855 instructions. To
give you an idea of the impact on programs that use the
library heavily, I ran `cat -v /sys/compile/FOO/bsd.gdb >
/dev/null' and measured the best run time out of 3 for each
flavor of cat. The dynamic version ran 20.59 seconds; the
static shared version ran 17.48 seconds; the static unshared
version ran 17.05 seconds. Since most programs run longer
and don't make the libraries do such a large proportion of
their computes, the impact of dynamic linking is generally
lost in the noise, however.)
For small, commonly-used programs, you can probably see how reducing
the setup cost from 300k to 2k instructions would add up. Think of
how many thousands of times a typical Unix system is running executables
like "echo" or "cat" in any given hour...
-s