I had a sudden doubt yesterday. I have been programming in C for a long time. My question is this:
Suppose there is a variable
static uint32_t count = 0;
This variable should be stored in the data segment.For the sake of this example let us assume that data segment starts at offset 0x08000000
in the 4GB virtual memory space of the process.
I know that somewhere after the offset 0x08000000
there is 4 byte reserved for the variable 'count' with the value 0.
My question is how is this 4-byte value in memory associated with the name "count" and the type "uint32_t" (or the fact that it is 4-bytes long and not 6 bytes long for example.)
From the answers below it seems that the mapping information is stored in the "symbol table"
It seems to suggest that it has to be a part of the final executable in memory.If so where is the symbol table stored? is it in the code/text segment?