linux-mips
[Top] [All Lists]

Re: question regarding bss section

To: Wolfgang Denk <wd@denx.de>
Subject: Re: question regarding bss section
From: Ralf Baechle <ralf@linux-mips.org>
Date: Tue, 28 Oct 2003 00:01:36 +0100
Cc: linux-mips@linux-mips.org
In-reply-to: <20031027194920.8D301C59E4@atlas.denx.de>
Original-recipient: rfc822;linux-mips@linux-mips.org
References: <20031027190829.GB24946@linux-mips.org> <20031027194920.8D301C59E4@atlas.denx.de>
Sender: linux-mips-bounce@linux-mips.org
User-agent: Mutt/1.4.1i
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

<Prev in Thread] Current Thread [Next in Thread>