This is the mail archive of the
mailing list for the binutils project.
How to verify init_priorty for C++ static object initialization order?
- From: Jeffrey Walton <noloader at gmail dot com>
- To: binutils at sourceware dot org
- Date: Sun, 13 Sep 2015 04:11:25 -0400
- Subject: How to verify init_priorty for C++ static object initialization order?
- Authentication-results: sourceware.org; auth=none
- Reply-to: noloader at gmail dot com
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
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.