Re: question regarding bss section

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Oct 27, 2003 at 08:49:15PM +0100, Wolfgang Denk wrote:

> In most implementations of ANSI C that I am aware of (including GCC /
> glibc), the BSS segment will be used for uninitialized variables with
> "static" storage  class.  Also,  I've  seen  some  compilers  to  put
> variables eplicitly initialized to zero into the BSS segment, too. To
> quote the C FAQ:
> 
>     Uninitialized variables with "static" duration (that is, those
>     declared outside of functions, and those declared with the
>     storage class static), are guaranteed to start out as zero, as if
>     the programmer had typed "= 0". Therefore, such variables

C doesn't know about .bss at all - no single mentioning in the ISO C
standard.  But .bss is a section name used in the ELF binary format which
most Linux systems are using.  The gABI says defines .bss:

.bss	This section holds uninitialized data that contribute to the
	program s memory image. By definition, the system initializes
	the data with zeros when the program begins to run. The section
	occupies no file space, as indicated by the section type,
	SHT_NOBITS.

Certainly the term ``uninitialized'' isn't as precise as desirable but
that's the wording used in the relevant standard.

  Ralf


[Index of Archives]     [Linux MIPS Home]     [LKML Archive]     [Linux ARM Kernel]     [Linux ARM]     [Linux]     [Git]     [Yosemite News]     [Linux SCSI]     [Linux Hams]

  Powered by Linux