Re: Initialized variables in .bss

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

 



On 11/24/2015 06:44 PM, Segher Boessenkool wrote:
> 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.

Thanks, this settles it.  It's available since GCC 4.

However, there is still a subtle difference for non-static objects.
Adding the initializer turns a tentative definition into a definite one,
and it seems that this can't go into .bss.

Florian



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux