In static storage, to use standard speak. It doesn't really say much of anything about how static storage should be implemented, other than that it should endure for the whole time of the program and that it should be implicitly zero initialized if no nonzero initializer is given.
Practically in ELF binaries, these variables are all concatenated into sections, which get, at load time, mapped onto segments, which are basically memory blocks with certain memory protection bits on or off. If the global variable is writable and initialized with a nonzero value, it'll go into an ELF section designated as .data
. zero
-initialized variables will go into .bss
(not part of the binary image so as to save space) and const
static variables will go into .rodata
, which will get mapped read-only, to facilitate write protection.
Your compiler's binutils (such as nm
or objdump
) can allow you to peek into the (implementation-dependent) details.