[ECOS] compile error when using newer version ecos configurat ion tool

Jeremias, Thilo tjeremias@rsasecurity.com.au
Sun Nov 4 21:14:00 GMT 2001

I think, ANSI-C, specifies that ALL non automatic vars, are implicitly
initialised to zero (that's BSS).
Automatic var s like (locals) contain garbage!

It's probably a religious discussion wether this is good or bad,
but IMHO I would always explicitly initialise anything I use.

-----Original Message-----
From: Trenton D. Adams [mailto:tadams@theone.dnsalias.com]
Sent: Wednesday, 14 November 2001 12:47
To: 'J. J. Farrell'
Cc: 'Andrew Lunn'; 'eCos'
Subject: RE: [ECOS] compile error when using newer version ecos
configuration tool

So, what you're saying is that BSS is infact for uninitialized
variables?  Because of the fact that the BSS section is initialized to
0, the uninitialized variables become initialized?

> -----Original Message-----
> From: J. J. Farrell [mailto:jjf@abaqos.com] 
> Sent: November 13, 2001 4:54 PM
> To: Trenton D. Adams
> Cc: 'Andrew Lunn'; 'eCos'
> Subject: Re: [ECOS] compile error when using newer version 
> ecos configuration tool
> On Tue, Nov 13, 2001 at 02:46:52PM -0700, Trenton D. Adams wrote:
> >
> > I think you're correct!  Why because the -fno-common option to GCC 
> > specifies that it will allow uninitialized data to be put 
> in the bss 
> > section.  Which indicates to me that it's not normal for ELF.
> > 
> > > From: Andrew Lunn [mailto:andrew.lunn@ascom.ch]
> > > 
> > > It seems the ELF spec specifies the .bss section is 
> initialized to 
> > > zero. Where as what you say about PE is that the contents are not 
> > > initialized. Something to remember when writing portable code!
> I think you're misinterpreting things here. gcc can be 
> configured to output for any number of different assemblers 
> and output formats, and -fno-common is applicable to many of 
> them - it has nothing in particular to do with ELF.
> -fno-common is concerned with controlling object linkage - 
> whether an external variable declared in more than one source 
> file results in a single object, or multiple objects with the 
> same name. It has nothing directly to do with initialization.
> C global variables which are not explicitly initialized must 
> be initialized by the compiler/linker/loader as if 0 had been 
> assigned to them. This is often achieved by describing them 
> in a .bss section without any initialization, then having the 
> loader initialize the .bss section to 0 when it loads the program.

More information about the Ecos-discuss mailing list