This breaks constructors on pretty much every elf+newlib target,
because newlib and gcc both use HAVE_INITFINI_ARRAY (and have for many
years) but the tests don't match.  GCC puts ctors in .ctors but libgcc
is built without support for them (newlib's generated config headers
define HAVE_INITFINI_ARRAY, which causes gcc's initini-array.h to set
USE_INITFINI_ARRAY, which shuts off libgcc's ctor/dtor support), so
they don't run.

> 2011-08-20  H.J. Lu  <>
>       PR target/46770
>       * config.gcc (tm_file): Add initfini-array.h if
>       .init_arrary/.fini_array are supported.
>       * crtstuff.c: Don't generate .ctors nor .dtors sections if
>       USE_INITFINI_ARRAY is defined.
>       * output.h (default_elf_init_array_asm_out_constructor): New.
>       (default_elf_fini_array_asm_out_destructor): Likewise.
>       * varasm.c (elf_init_array_section): Likewise.
>       (elf_fini_array_section): Likewise.
>       (get_elf_initfini_array_priority_section): Likewise.
>       (default_elf_init_array_asm_out_constructor): Likewise.
>       (default_elf_fini_array_asm_out_destructor): Likewise.
>       * config/initfini-array.h: New.

Reply via email to