C++ static constructors and SMP

Chris Johns chrisj at rtems.org
Sun Oct 20 01:09:29 UTC 2013


On 20/10/13 11:30 AM, Gedare Bloom wrote:
> Hi,
> I'm not a C++ expert (You might get better advice from the GCC
> community.) but I'm pretty sure initializing static constructors is
> done by the compiler, so the relevant code would be found in gcc
> located with either .init/.fini, .init_array/.fini_array or
> .ctors/.dtors. RTEMS just puts them in the right place via linkcmds
> file. I guess the C++ runtime startup is not honoring some assumptions
> made about the static constructors.
>

This is a bug in RTEMS. The cores need to wait until the constructors 
have run. I have not had time to take a closer look because Joel keeps 
bringing me beer ... which I do not mind.

Chris

> -Gedare
>
>
>
>
>
>
> On Fri, Oct 18, 2013 at 2:07 PM, Stephen Tether
> <tether at slac.stanford.edu> wrote:
>> Hi, all. At SLAC we've just started to experiment with the ML1 SMP version
>> of RTEMS 4.11.0.1 on the Zynq. We're having a problem with some statically
>> allocated C++ objects: the constructors are not being called before the
>> first calls to the objects' member functions, which eventually results in a
>> data abort due to a null pointer. Sometimes the constructors *are* called
>> first, sometimes they are called too late and sometimes they don't get
>> called at all before the abort. How are static constructors handled in this
>> version of RTEMS and which source files do I need to look at?
>>
>> - Steve Tether
>> _______________________________________________
>> rtems-devel mailing list
>> rtems-devel at rtems.org
>> http://www.rtems.org/mailman/listinfo/rtems-devel
> _______________________________________________
> rtems-devel mailing list
> rtems-devel at rtems.org
> http://www.rtems.org/mailman/listinfo/rtems-devel
>



More information about the devel mailing list