How does the BSS segment manage to hold the details if it does not occupy any file size?
The ELF sp开发者_开发技巧ecification conveys that the .bss section does not occupy any file size. I wonder then, how does it manage to hold the details if it does not occupy any file size ? Please clarify me.
You do not quote the section of the ELF specification, and when I searched I did not find "BSS" identified explicitly, so I'll quote the Wikipedia entry for BSS:
In computer programming, the name .bss or bss is used by many compilers and linkers for a part of the data segment containing statically-allocated variables represented solely by zero-valued bits initially (i.e., when execution begins). It is often referred to as the "bss section" or "bss segment".
And the answer is simple: if you know that all values will be initialized to zero, there's no need to explicitly specify those values in the executable file.
精彩评论