This is the mail archive of the gcc-help@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]
Other format: [Raw text]

Re: c++ static initialization question


2010/3/8 Ian Lance Taylor <iant@google.com>:
> Juan Carlos Franzoy <jfranzoy@gmail.com> writes:
...
>
> The backtrace in http://gcc.gnu.org/ml/gcc-help/2010-03/msg00090.html
> does not make much sense to me.
It makes less sense to me.

> ... ?Somehow calling
> ats::base::getEnvironmentVariable leads to a call to _init. ?How does
> that happen? ?Do you have different shared libraries involved?
Yes, actually there are 3 shared libraries involved.
   1) libAtsBase: The one wich has Loggers
   2) libAtsStore: wich has the first statically Logger object
constructed (frame #19)
   3) libRTDB: which has the second Logger object statically and
reentrantly constructed.

    The funny fact is that de dependencies between them are:
       libAtsStore -> libRTDB ->libAtsBase
       libAtsStore -> libAtsBase
    The arrows meands 'use'.
    I would espect that something in libRtdb could trigger libAtsBase
static initialization, not the reverse.

> ... ?It seems that perhaps a symbol in one shared library is referring to a
> symbol defined in a different shared library, and that the Solaris
> dynamic linker is deciding to run the static initializers in the
> latter library. ?This is then leading to the reentrant call.
>
> Ian
>

Anyway. I will investigate it later. Until that I will suppouse "Any
code run in static initialization that call code on another
translation unit may trigger static initialization of other objects".

Thanks, very much Ian for your help.


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