public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* Lazy binding of virtual table entries?
@ 2004-11-07 22:12 Antti Kerola
  2004-11-08 19:00 ` Ian Lance Taylor
  0 siblings, 1 reply; 2+ messages in thread
From: Antti Kerola @ 2004-11-07 22:12 UTC (permalink / raw)
  To: binutils; +Cc: antti.kerola

We have problems with slow application startup.

We have a rather large application, about 2 million lines of code, in about 
80 shared libraries.
I have found out with LD_DEBUG that relocation of virtual table entries in 
the shared libraries takes
place at the start up. This is now taking several seconds.  According to 
LD_DEBUG, all the
other function bindings are performed lazily.

- Is there a way to bind also the virtual table entries lazily?
- Alternatively, is there a way to prelink the executable so that the 
virtual table entries
are resolved at link time without linking the whole app statically to one 
huge binary?

We are using Solaris 2.8 on Sparc with gcc 3.3.2 configured for gnu ld and 
gnu as.
Our binutils version is 2.13.2.1. We are prepared to consider updating our 
tool set to
resolve this problem, though.

We are compiling with -fPIC. There are no other switches affecting code 
generation.

There is some background information below

Each module in a library typically defines a new class which is derived 
from one of our
base classes. Base classes may have almost 100 methods so we end up having
a virtual table referencing to these base class methods in each application 
module.

The executable has no objects of its own. It is just a bunch of shared 
libraries linked together.

Antti

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Lazy binding of virtual table entries?
  2004-11-07 22:12 Lazy binding of virtual table entries? Antti Kerola
@ 2004-11-08 19:00 ` Ian Lance Taylor
  0 siblings, 0 replies; 2+ messages in thread
From: Ian Lance Taylor @ 2004-11-08 19:00 UTC (permalink / raw)
  To: Antti Kerola; +Cc: binutils

Antti Kerola <antti.kerola@uta.fi> writes:

> We have a rather large application, about 2 million lines of code, in
> about 80 shared libraries.
> I have found out with LD_DEBUG that relocation of virtual table
> entries in the shared libraries takes
> place at the start up. This is now taking several seconds.  According
> to LD_DEBUG, all the
> other function bindings are performed lazily.
> 
> - Is there a way to bind also the virtual table entries lazily?

No.  I can't think of any way to do that without making virtual
function calls less efficient at runtime.

> - Alternatively, is there a way to prelink the executable so that the
> virtual table entries
> are resolved at link time without linking the whole app statically to
> one huge binary?

GNU/Linux has a prelinker which can do this.  But the dynamic linker
has to recognize the prelinking, and presumably the Solaris dynamic
linker won't recognize what the GNU/Linux prelinker does.  I don't
know whether Sun provides any similar prelinking functionality for
Solaris.

Ian

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2004-11-08 19:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-11-07 22:12 Lazy binding of virtual table entries? Antti Kerola
2004-11-08 19:00 ` Ian Lance Taylor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).