This is the mail archive of the
mailing list for the binutils project.
Re: PATCH COMMITTED: Implement constructor priorities in gold
- From: "Matt Rice" <ratmice at gmail dot com>
- To: "Michael Hennebry" <hennebry at web dot cs dot ndsu dot nodak dot edu>
- Cc: "Ian Lance Taylor" <iant at google dot com>, binutils at sourceware dot org
- Date: Fri, 28 Mar 2008 17:34:47 -0700
- Subject: Re: PATCH COMMITTED: Implement constructor priorities in gold
- References: <firstname.lastname@example.org> <20080328181847.W6777email@example.com>
On Fri, Mar 28, 2008 at 4:21 PM, Michael Hennebry
> What are constructor priorities?
> Google produces several results,
> including comments to the effect that some compiler
> or another doesn't implement them correctly,
> but nothing informative to me.
it is my possibly naive interpretation that constructor priorities
allow you to specify the order in which constructors are called,
imagine the situation where you have libA and libB both with constructors
libB has a dependency and calls a function from libA in its constructor.
libA's implementation of the called function depends upon the
constructor being run
now afaik the order in which constructors are called is not defined
will libA's constructor get called before libB's constructor or libB's
constructor get called before libA's.
iirc I have seen both of these interpretations so without priorities
the only safe thing is to insure in the called function that the
constructor has been indeed called, or require massaging of the link
order to ensure that libA gets loaded first before libB..
this may not be the appropriate place to mention this but i noticed
the documentation on constructor priorities do not specify what the
default constructor priority is and was left wondering