Problem with shared libraries, exceptions, and global constructors

Richard Henderson rth@redhat.com
Tue Aug 19 08:24:00 GMT 2003


On Tue, Aug 19, 2003 at 10:44:18AM +1000, Fergus Henderson wrote:
> The correct initialization sequence is one that initializes
> the exception handling information for all .so files before calling
> constructors of global objects in any files.

Ignore exception handling.  It's a red herring.  Indeed, with
a recent ld on a recent linux system exception handling doesn't
need to be initialized -- we read the data from ELF headers.

But the same problem ocurrs with any other sort of global state
that needs constructing.  E.g. standard io.

> Of course the C++ standard doesn't say anything about dynamic
> linking, but it is undesirable for one feature (mutual recursion)
> to interfere with another (dynamic linking).

I'm sorry if ELF dynamic linking was not designed with your
requirements in mind.


r~



More information about the Gcc mailing list