This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: Display initialization order of static C++ objects in a library or program?
- From: Matt Rice <ratmice at gmail dot com>
- To: noloader at gmail dot com
- Cc: Binutils <binutils at sourceware dot org>
- Date: Sat, 9 Jan 2016 14:54:13 -0800
- Subject: Re: Display initialization order of static C++ objects in a library or program?
- Authentication-results: sourceware.org; auth=none
- References: <CAH8yC8mRamf3ZR+Onm5ny3w13dvsyLjbZ2QCDafAXF_WzM4CPQ at mail dot gmail dot com>
On Sat, Jan 9, 2016 at 1:27 PM, Jeffrey Walton <noloader@gmail.com> wrote:
> I'm trying to track down the cause of a Valgrind finding for an
> uninitialized read. I'm fairly certain it has to do with C++ static
> initialization order fiasco.
>
> How do I display initialization order of static C++ objects in a
> library or program?
>
> My apologies for a basic question. I'm having a difficult time finding
> this information.
>
> Thanks in advance.
This is by its nature platform dependent, with glibc you can get this
information by setting the environment variable LD_DEBUG=libs (the
calling init: lines), but don't expect the initialization order to
produce the same results on another platform.