How to verify init_priorty for C++ static object initialization order?
Jeffrey Walton
noloader@gmail.com
Sun Sep 13 08:11:00 GMT 2015
I'm working with a C++ library. The library creates both (1) static
archive and (2) shared object artifacts. The library has four C++
static objects. Two of them are std::string's and two are library
classes.
On occasion, I see the effects of a bad shuffle of initialization
order. I usually observe it by one of the std::string's "this" pointer
being NULL during init. In an effort to remediate the C++ static
initialization order issue, we switched to GCC's init_priority (and
"#pragma init_seg(lib)" on Microsoft platforms).
I have an object file and an archive. How can I verify the priority is
embedded in both the object file and archive?
Thanks in advance.
More information about the Binutils
mailing list