This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [arm] Use .init_array for static constructors.
- From: Mark Mitchell <mark at codesourcery dot com>
- To: Paul Brook <paul at codesourcery dot com>
- Cc: gcc-patches at gcc dot gnu dot org, Richard Earnshaw <rearnsha at arm dot com>
- Date: Fri, 24 Sep 2004 11:00:11 -0700
- Subject: Re: [arm] Use .init_array for static constructors.
- Organization: CodeSourcery, LLC
- References: <200409240047.20463.paul@codesourcery.com>
Paul Brook wrote:
The following patch makes arm targets use the .init_array section for static
constructor lists. Non-eabi targets are unaffected. The pointers in this
section are relocated by relocated by an R_ARM_TARGET1 relocation.
The eabi doesn't provide a mecahnism for supporting the init_priority
attribute, so I've disables support for this on eabi based targets.
The eabi doesn't mention how static destructor lists should be handled, though
it's implied that the atexit functionality makes these unnecessary.
I've left the handling of .dtors unchanged.
There is still at least one way to get a static destructor:
void f() __attribute__((destructor));
in GNU C. (In C++, all static destructions should be registered with
atexit, as you say.)
I'm not sure what to do about that, though, if the ABI doesn't say.
Tested with cross to arm-none-elf and arm-none-eabi.
Ok for csl-arm-branch? mainline?
Looks good to me for csl-arm-branch. I think this should go on
mainline, too, but I think that an ARM maintainer should sign off first.
--
Mark Mitchell
CodeSourcery, LLC
(916) 791-8304
mark@codesourcery.com