C++ static constructors and SMP

Gedare Bloom gedare at rtems.org
Sun Oct 20 00:30:29 UTC 2013

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.


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 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

More information about the devel mailing list