This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC 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][rfc] How to handle static constructors on linux


> 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).

Just a  bit of context: I tried to build chrome in order to test a
completely unrelated change (it is an awesome compiler test case) and
got a protocol compiler crash, which is where all this started. I
don't work with chrome or know why they are using gold 2.21.

I do work on firefox and we are using centos 5's linker and gcc 4.5 :-(

But I am still missing something, why is the performance so different?
Code layout putting the constructors' body in the reverse order they
are called?

> -cary

Cheers,
Rafael


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