I am wondering how and when static inline data is initialized in C++ (for example in gcc or clang). I know it is a question specific to some architecture and it is not related to the C++ standard.
I know that for static/global non-inline data gcc is using the .init
and .fini
sections for constructing and destructing objects with such qualifiers but this won't work for inline static data because it can be initialized in many translation unit so the init
section will end up with many initializations to do for a single object which is wrong.
Does anyone know how the implementation works?
To be clear I am interested in the implementation of the initialization of those inline variables.