Initialized variables in .bss

Segher Boessenkool segher@kernel.crashing.org
Tue Nov 24 17:44:00 GMT 2015


On Tue, Nov 24, 2015 at 04:44:23PM +0100, Florian Weimer wrote:
> It seems that GCC has an optimization that turns
> 
>   static int a = 0;
> 
> into
> 
>   static int a;
> 
> and puts the symbol into .bss instead of .data (on GNU/Linux).
> 
> Is this correct?  Would it make sense for glibc to rely on this
> optimization (purely as an optimization)?

See -fzero-initialized-in-bss.


Segher



More information about the Gcc-help mailing list