How do global variables get initialized by the elf loader

Posted by newguy on Stack Overflow See other posts from Stack Overflow or by newguy
Published on 2010-04-15T22:08:01Z Indexed on 2010/04/15 22:13 UTC
Read the original article Hit count: 355

Filed under:
|
|

For global variables in C like

int aglobal = 5;

When does the 5 get transferred into aglobal by the loader and how does it know to put 5 in aglobal.

Same situation with a static declaration in a function. Like

int afunc() { static int astatic = 8; return astatic; }

© Stack Overflow or respective owner

Related posts about elf

Related posts about global