This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: [I don't think it's off-topic at all] Linking speed for C++
On Wednesday 09 May 2001 11:45, Richard Henderson wrote:
> On Wed, May 09, 2001 at 11:39:04AM -0700, Joe Buck wrote:
> > Clearly, if the pointer points to a global symbol that is defined
> > externally, we we still need a relocation. But it will be common to
> > refer to a function whose definition comes from the same object file, or
> > the same .so (meaning that relocations can be eliminated when building
> > the shared library).
>
> No, you misunderstand. If the symbol is _visible_ externally, then a
> dynamic relocation is required. Even if the actual definition comes
> from the current dso. This is just the way ELF dynamic linking works.
What might help, but correct me if I have missed something, is if virtual
function calls would go through the PLT, just like normal function calls.
That would reduce the number of relocations needed (cause if one function is
present in two vtables it now requires two relocations, and then only one),
and it would make it possible to use lazy binding for them.
Someone mentioned that using "-fvtable-thunks=3" (in gcc 2.95.3?) would
actually do something like that but I haven't been able to verify that.
Cheers,
Waldo
--
bastian@kde.org | SuSE Labs KDE Developer | bastian@suse.com