avr-gcc-list
[Top][All Lists]
Advanced

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

Re: [avr-gcc-list] RE: data segment init code & .data size calculations


From: Erik Christiansen
Subject: Re: [avr-gcc-list] RE: data segment init code & .data size calculations
Date: Mon, 13 Sep 2004 18:46:56 +1000
User-agent: Mutt/1.5.6+20040722i

On Sat, Sep 11, 2004 at 04:55:50PM +0300, Dafni & Robert Berger wrote:
> Joerg Wunsch wrote:
> 
> >Just a nit: .bss is not for `locals', but for global/static variables
> >that default to the initialization value of 0 (or NULL).
> 
> So far I thought that uninitialized data (static/global) go to .bss and
> initialized ones go to .data.

Yep.

> Do you mean, that also e.g. static int a=0; goes to bss?

Nope, but it is a convention, that the "uninitialized data" is actually
initialised to zero. There are said to be C programs that won't work
unless this is so. (Though few of us would admit to writing them. :)

Every crt0 that I've fiddled with does this, and even in the ld info we
see confirmation of the convention amongst it's description of the
responsibilities of crt0:

          /* Zero bss */
          for (dst = _bstart; dst< _bend; dst++)
            *dst = 0;
   
Erik



reply via email to

[Prev in Thread] Current Thread [Next in Thread]