Hi there,
I'm using clang to cross compile my firmware for an ARM based cpu.
I need to set up the C++ environment myself, which means I have
to call the constructors of all static objects.
After a bit of searching on the matter I saw that GCC have a
specific ELF section for this (.ctors*), where constructors address are
laid out in an array etc... so I was looking for the same on clang.
By looking at the generated ELF I found not such section, and
by looking at the disassembled code I instead noticed the __cxx_global_var_initN
symbols, and a quick grep on clang source code brought me to
CreateGlobalInitOrDestructFunction which seems to generate the calls themselves.
Still by looking at the dissambled I noticed the _GLOBAL__I_a routine where
all the calls to the various __cxx_global_var_initN are placed. So far so good.
Unfortunately though I get more than one _GLOBAL__I_a symbol in the
final binary,
and a simple call to _GLOBAL__I_a in my startup code does not work.
Are they placed in a particular section?
Now, I could keep digging in the clang and libcxxabi code base until eventually
(hopefully) I find the answer but I would really appreciate if
someone can point me
to a document that explain how this process works and what I need to
get it done?
Thanks,
Salvatore