linux-mips
[Top] [All Lists]

Re: question regarding bss section

To: Ralf Baechle <ralf@linux-mips.org>
Subject: Re: question regarding bss section
From: Wolfgang Denk <wd@denx.de>
Date: Mon, 27 Oct 2003 20:49:15 +0100
Cc: linux-mips@linux-mips.org
In-reply-to: Your message of "Mon, 27 Oct 2003 20:08:29 +0100." <20031027190829.GB24946@linux-mips.org>
Original-recipient: rfc822;linux-mips@linux-mips.org
Sender: linux-mips-bounce@linux-mips.org
In message <20031027190829.GB24946@linux-mips.org> you wrote:
> 
> > > .bss is uninitialized.  Initialized data can't be in .bss.
> > 
> > No. BSS is initialized as zero.
> 
> RTFM.  It's unitialized because not contained in the binaries.

When an application runs it will see the BSS space as initialized  as
zero.

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


Best regards,

Wolfgang Denk

-- 
Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
Phone: (+49)-8142-4596-87  Fax: (+49)-8142-4596-88  Email: wd@denx.de
Quantum particles: The dreams that stuff is made of.

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