[ECOS] order of calling for static initializers

Andrew Lunn andrew@lunn.ch
Wed Nov 29 03:23:00 GMT 2006

On Tue, Nov 28, 2006 at 06:42:51PM -0500, Tom Malcolmson wrote:
> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
> <html>
> <head>
>   <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
> </head>
> <body bgcolor="#ffffff" text="#000000">
> Thanks Andrew.<br>
> <br>
> It seems to be working now, but, for the record, I'll list the changes
> that I had to make to get the initializers called in the right order
> using CodeSorcery tools.<br>
> <br>
> I know that these changes solved my problems, but my explanations are
> uncertain.<br>
> <br>
> 1.  I had to change the linker script to use .init_array* and
> .fini_array* instead of .ctor and .dtor.<br>
> <br>
> 2.  I had to reverse the order in which static initializers are called
> in the cyg_hal_invoke_constructors function my architectures'
> hal_misc.c.  From what you (Andrew) say this is because the SORT linker
> command causes the sections to be sorted in reverse order with cygwin
> but not with CS.<br>

Just for the record, this has nothing to do with cygwin. Its plain gcc
verses CS. I was using the Linux version of the tools when i look at
the order SORT produces.


Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

More information about the Ecos-discuss mailing list