This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: [I don't think it's off-topic at all] Linking speed for C++


On Wed, May 09, 2001 at 12:29:53PM -0700, Waldo Bastian wrote:
> 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.

Not quite.  It would help, since the vtable would then use a
RELATIVE relocation, which does not require a symbol lookup.

The problem on x86 is that the PIC PLT entry requires that 
%ebx already be set up properly _for that dso_.  Which means
that you can't the PLT entry for a different dso, which is
what you'd be doing if you put the address of the PLT entry
in the vtable.

It would be possible to generate stub functions along with
the vtable instead.  I've not got a clear idea what that 
would do to program size and performance.

> 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.

Incorrect.


r~


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]