Actions

icon Post
text/html Subscribe
text/html Unsubscribe

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

GNU constructor priority implementation


  • To: cxx-abi@xxxxxxxxxxxx
  • Subject: GNU constructor priority implementation
  • From: Jason Merrill <jason@xxxxxxxxxx>
  • Date: Thu, 15 Jul 1999 03:06:59 -0700

g++ uses an attribute to assign a numeric priority to the initialization of
a particular object; something like

A a (42) __attribute__ ((init_priority (420)));

The normal g++ handling of static constructors is to generate a function
for the translation unit which runs all of the constructors in order.  In
the presence of priorities, there is a function for each priority.
The non-prioritized function goes into .ctors, and the prioritized
functions go into .ctors.%.5u.  The .ctors* sections are sorted by the
linker into a single .ctors section for the executable.

Jason