Re: c++ static initialization question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



2010/3/8 Ian Lance Taylor <iant@xxxxxxxxxx>:
> Juan Carlos Franzoy <jfranzoy@xxxxxxxxx> 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 of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux