3 ms·
> Why do you say that? Your post gave me the impression the compiler generates initializers for static globals and calls them during program initialization. Is
by matheusmoreira 3y ago
> Why do you say that?
Your post gave me the impression the compiler generates initializers for static globals and calls them during program initialization. Is this not correct?
> A freestanding environment will still enter through _start and execute the compiler generated code to initialize globals before main.
Freestanding C generally implies not linking in any standard library code though. It doesn't make any sense to choose the freestanding C dialect only to link in the standard hosted C library.
The _start symbol is provided by the C library's so called standard system startup files. The standard _start calls all the initialization functions that the C program expects. If you override it with your own _start, then none of these functions will be called. I thought you meant the static data initialization was handled in one of these functions.