[LLVMdev] C++ Constructors

Anton Korobeynikov anton at korobeynikov.info
Fri Dec 12 08:15:58 PST 2008


Hi, John

> Another question: the llvm.global.ctor array is an array of structures
> with an integer and a function pointer.  What information does the
> integer convey?
In general, it should be "priority" of the ctor. Runtime traverses the
list of ctors from beginning to end. Thus, sorting the array of ctors
and emitting them in some specified order - we can force one ctor to
be run after another. This integer (see, e.g. gcc docs for
'constructor' attribute) should introduce such priority order.

I don't remember offhand, whether it's currently properly implemented,
or not....
-- 
With best regards, Anton Korobeynikov
Faculty of Mathematics and Mechanics, Saint Petersburg State University



More information about the llvm-dev mailing list