This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH,target]AVR - disable constructor init priorities
- From: Andy H <hutchinsonandy at aim dot com>
- To: gcc-patches at gcc dot gnu dot org, Anatoly Sokolov <aesok at post dot ru>, "Weddington, Eric" <eweddington at cso dot atmel dot com>
- Date: Sun, 15 Jun 2008 13:43:27 -0400
- Subject: [PATCH,target]AVR - disable constructor init priorities
Anatoly,
Init priorities allows the order of constructor/destructors to be
controlled. This is not supported by the AVR code (it would need to use
named sections with linker support).
So we accept
void d1() __attribute__((destructor (100)));
void d2() __attribute__((destructor (600)));
void d3() __attribute__((destructor (400)));
and produce wrong code, as destructors and constructor will be applied
in arbitrary order without warning.
Patch sets support flag *SUPPORTS_INIT_PRIORITY *to zero, so that the
above will cause error:
"constructor priorities are not supported"
Plain contrsuctors/destructors are unaffected - for example:
void c1() __attribute__((constructor ()));
Tested on 4.4 HEAD. Ok for mainline ?
2008-06-15 Andy Hutchinson <hutchinsonandy@aim.com>
* config/avr/avr.h (*SUPPORTS_INIT_PRIORITY): Define.
*
Attachment:
ctor.patch
Description: Text document