http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46770
--- Comment #5 from H.J. Lu <hjl.tools at gmail dot com> 2010-12-07 16:45:11 UTC --- (In reply to comment #2) > Hmm, is it possible to do the change without breaking ABI (i.e. preserving the > proper relative order for binary built with init_arra/fini_array linked with > ctors/dtors library and vice versa? > Honza [...@gnu-6 46770]$ cat foo.c #include <stdio.h> static void init () { printf ("init_array\n"); } static void (*const init_array []) () __attribute__ ((section (".init_array"), aligned (sizeof (void *)))) = { init }; static void fini () { printf ("fini_array\n"); } static void (*const fini_array []) () __attribute__ ((section (".fini_array"), aligned (sizeof (void *)))) = { fini }; static void ctor () { printf ("ctor\n"); } static void (*const ctors []) () __attribute__ ((section (".ctors"), aligned (sizeof (void *)))) = { ctor }; static void dtor () { printf ("dtor\n"); } static void (*const dtors []) () __attribute__ ((section (".dtors"), aligned (sizeof (void *)))) = { dtor }; int main () { printf ("main\n"); } [...@gnu-6 46770]$ gcc foo.c [...@gnu-6 46770]$ ./a.out ctor init_array main fini_array dtor [...@gnu-6 46770]$