Shared library annoyance with gcc-3_0-branch
Linus Torvalds
torvalds@transmeta.com
Tue Feb 20 11:54:00 GMT 2001
On Tue, 20 Feb 2001, Geert Bosch wrote:
>
> BTW, what is the overhead on Linux for calling routines in dynamic
> libraries as opposed to code statically linked in? Has anybody done
It's noticeable, and it depends on the architecture.
With static linking, you can often do static optimizations that tend to be
rather nasty to do on any dynamic libraries. Things like knowing when the
rotines share GOT entries etc. Things like knowing that you could just use
a short indirect branch instead of having to go through a register.
There's also the issue of just loading, which can be expensive in itself.
However, most cases where you _really_ care, and are willing to work at
it, can just link statically, I suspect.
I don't think performance is the first-order worry here. libgcc doesn't
tend to be _that_ performance-sensitive (if it was, much of it would be
inlined - but it tends to be used for stuff where the overhead of a
function call is not all that noticeable).
Linus
More information about the Gcc
mailing list