[llvm-commits] [patch][rfc] How to handle static constructors on linux

Cary Coutant ccoutant at google.com
Mon Jun 18 11:29:01 PDT 2012


>> Furthermore, if you're working in chromium, you should be aware that
>> the new behavior is exactly what the Chrome developers are arguing
>> for, as it makes the startup faster. It sounds to me like you're
>> working at cross purposes with the other developers on that project.
>
> Ah, perhaps this goes to answer my question from the other mail: why
> switch to '.init_array'?

This has a long and complicated history. I tried to explain some of that here:

   http://gcc.gnu.org/ml/gcc-bugs/2010-12/msg01493.html

I wasn't part of the GCC community at the time, but I think that
.ctors was originally used instead of .init or .init_array precisely
because the order of execution of .init/.init_array was backwards from
the desired order of execution for constructors (leaving aside the
fact that it was backwards from the desired order of execution for
*any* kind of initializer). Now that GCC has finally moved from .init
to .init_array, they're simply trying to consolidate on the One True
Initializer Mechanism. In doing so, it would be desirable to correct
that mistake we made so long ago in the gABI, but that's where we ran
up against the concerns of the Chrome and Firefox developers who care
more about startup performance than about constructor ordering (but,
apparently, not enough to use linker options to reorder the code in
order to get both good performance *and* proper execution order).

-cary



More information about the llvm-commits mailing list