This is the mail archive of the mailing list for the binutils project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: PATCH COMMITTED: Implement constructor priorities in gold

On Fri, Mar 28, 2008 at 4:21 PM, Michael Hennebry
<> wrote:
>  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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]