Static Initializers

You must invoke static initializers to initialize static data before the start of main(). To do so, use the STATICINIT keyword to have the linker generate the static initializer sections.

In your linker command file, use lines similar to the lines listed below, to tell the linker where to put the table of static initializers (relative to the ' .' location counter):

  ___sinit__ = .;  
  STATICINIT  

The program knows the symbol ___sinit__ at runtime. So in startup code, you can use corresponding lines such as these:

  #ifdef __cplusplus  
  /* call the c++ static initializers */  
 __call_static_initializers();  
  #endif