This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Shared library annoyance with gcc-3_0-branch
- To: Geert Bosch <bosch at gnat dot com>
- Subject: Re: Shared library annoyance with gcc-3_0-branch
- From: Linus Torvalds <torvalds at transmeta dot com>
- Date: Tue, 20 Feb 2001 11:53:51 -0800 (PST)
- cc: Andreas Schwab <schwab at suse dot de>, dewar at gnat dot com, rth at redhat dot com, aoliva at redhat dot com, gcc at gcc dot gnu dot org
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