This is the mail archive of the
mailing list for the binutils project.
Re: PATCH COMMITTED: Implement constructor priorities in gold
"Matt Rice" <firstname.lastname@example.org> writes:
> On Fri, Mar 28, 2008 at 4:21 PM, Michael Hennebry
> <email@example.com> 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,
search for "constructor (priority)".
> 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
It's intentionally left undefined. What happens today is that the
objects which appear first in the link command have their constructors
run first. However, when several different objects are included from
a single archive file, it is difficult to predict which one's
constructors will be run first. Destructors are run in the reverse
order of constructors.