Computer Systems: A Programmer's Perspective says about two sections in a ELF relocatable object file:
.data Initialized global and static C variables. Local C variables are maintained at run time on the stack and do not appear in either the .data or .bss sections.
.bss Uninitialized global and static C variables, along with any global or static variables that are initialized to zero. This section occupies no actual space in the object ﬁle; it is merely a placeholder. Object ﬁle formats distinguish between initialized and uninitialized variables for space efﬁciency: unini- tialized variables do not have to occupy any actual disk space in the object ﬁle. At run time, these variables are allocated in memory with an initial value of zero.
Do "initialized" and "unitiailized" in the quote mean explicitly or implicitly or either?
if a global or static C variable is not explicitly initialized, but implicitly initialized, is it in .data or .bss section?
Does it matter whether the global or static C variable is implicitly initialized to zero or nonzero?
The requirements for .data and for .bss are not mutually exclusive. The .data requirement of "Initialized global and static C variables" doesn't say that such variables must be initialized to nonzero. So if a global or static C variable is initialized to zero, should it be in .data or .bss section?