[PATCH] Use .init_array, .fini_array sections for ARM EABI

Julian Brown julian@codesourcery.com
Thu Apr 28 14:07:00 GMT 2005


Hi,

This is a combination of three patches from the csl-arm-branch:

   http://gcc.gnu.org/ml/gcc-patches/2004-09/msg02475.html
   http://gcc.gnu.org/ml/gcc-patches/2004-11/msg01901.html
   http://gcc.gnu.org/ml/gcc-patches/2005-01/msg01534.html

It causes .init_array and .fini_array, rather than .ctors and .dtors, to 
be used for static object construction/destruction for the ARM EABI. 
(Parts of the second patch relating to exception handling are omitted).

Tested on arm-none-eabi. Note that this is also dependent on this 
binutils patch:

   http://sources.redhat.com/ml/binutils/2005-04/msg00824.html

OK to apply?

ChangeLog:

   * crtstuff.c: Handle targets that use .init_array.
   * function.c (HAS_INIT_SECTION): Do not define. Instead, make sure
   that INVOKE__main is set correctly.
   (expand_main_function): Test INVOKE__main.
   * libgcc2.c: Do not define __main when using .init_array.
   * config/arm/arm.c (arm_elf_asm_constructor): New function.
   * config/arm/arm.h (CTORS_SECTION_ASM_OP): Define, with specialized
   libgcc version.
   (DTORS_SECTION_ASM_OP): Likewise.
   (CTOR_LIST_BEGIN): Define specially when in libgcc.
   (CTOR_LIST_END): Likewise.
   (DTOR_LIST_BEGIN): Likewise.
   (DTOR_LIST_END): Likewise.
   * config/arm/bpapi.h (INIT_SECTION_ASM_OP): Do not define it.
   (FINI_SECTION_ASM_OP): Likewise.
   (INIT_ARRAY_SECTION_ASM_OP): Define.
   (FINI_ARRAY_SECTION_ASM_OP): Likewise.
   * config/arm/elf.h (TARGET_ASM_CONSTRUCTOR): Define.
   (SUPPORTS_INIT_PRIORITY): Evaluate to false for EABI based targets.
   * doc/tm.texi (INIT_ARRAY_SECTION_ASM_OP): Document.
   (FINI_ARRAY_SECTION_ASM_OP): Likewise.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: init-fini-comb-three
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20050428/edb5e6d1/attachment.ksh>


More information about the Gcc-patches mailing list