http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46770
--- Comment #7 from Jan Hubicka <hubicka at gcc dot gnu.org> 2010-12-11 14:15:04 UTC --- Hi, thanks for testcase. What I was concerned about is the static linking case. When you have static library with constructors and main program with constructors, my understanding was that the reverse execution order of .ctor section was designed in a way so library even in this case is initialized first. Now because ctors are handled before init_array, this no longer happen. I.e. when I turn foo1.c into library (and add function used from foo.o) and compile as gcc -o foo4 foo2.o foo.o -l foo -L. I still get init_array main fini_array dtor i.e. the library is initialized later. I am not sure that this is actual requirement, or QOI issue or just something I was told to explain why ctor section is executed backwards while dtors forward (it would make more sense performance wise to reverse this). But in order to approve the patch I need to unerstand this better... Honza