, . g_glbarr char . , g_glbarr . , .
@Jay, . () : , , , . - . , - :
struct X {int a; char * b; } x = { 1, "Hello" } ;
1becomes “immediate” data, "Hello"is allocated in read-only data somewhere, and the compiler simply generates what allocates a portion of the read-write data, which looks something like
x:
x.a: WORD 1
x.b WORD @STR42
where STR42is the symbolic name for placing the string "Hello"in memory. Then, when everything is connected to each other, it @STR42is replaced by the actual virtual address of the line in memory.
source
share