开发者

How does the BSS segment manage to hold the details if it does not occupy any file size?

开发者 https://www.devze.com 2023-02-28 03:12 出处:网络
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 cla

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号