[Bug c++/28715] New: Attribute with section (".init_array") does't work under SPARC
Normally the following code produces a new section with type SHT_INIT_ARRAY and the function foo will be executed before the main routine starts. This is what i got unter Linux-Systems. But under SPARC Systems the new section entry is of type SHT_PROGBITS and won't execute before the main-routine. static void foo() { ; }; void (*const init_array []) (void) __attribute__ ((section (".init_array"), aligned (sizeof (void * = { &foo }; int main() {printf("main"); return 0;} -- Summary: Attribute with section (".init_array") does't work under SPARC Product: gcc Version: 3.4.0 Status: UNCONFIRMED Severity: major Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: pastoor dot external at onespin-solutions dot com GCC build triplet: SPARC GCC host triplet: SPARC GCC target triplet: SPARC http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28715
[Bug target/28715] Attribute with section (".init_array") does't work under SPARC
--- Comment #2 from pastoor dot external at onespin-solutions dot com 2006-08-14 13:51 --- Okay, but when i execute the ELF under SPARC the init_array entries aren't executed. Loaders don't look in the sectionheadertable because all information they need are in the programmheadertable. I think the init_array isn't handled in the right way in the segments (for SPARC) and thats because it is specified as SHT_PROGBIT in the sectionheadertable, because PROGBITS aren't executed before the main-routine. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28715