Re: Zero Initialized in BSS

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

 





On 3/24/07, John Anthony Kazos Jr. <jakj@xxxxxxxxxxx> wrote:
I've read kernel-hacking documentation that says you should never
initialize any member of a static struct to zero because it's already zero
from being in the BSS and if you initialize it, it gets pulled back into
the main data segment.

But the current GCC documentation states that the
-fzero-initialized-in-bss flag is on by default, with or without
optimization, and I haven't found -fno-zero-initialized-in-bss in the
build rules. So if a variable being initialized brings it back into data,
being initialized to zero should put it right back into bss.

I think you may not get this right:  this is from GCC man : If the target supports a BSS section, GCC by default puts variables that are initialized to zero into BSS.  This can save space in the resulting code.

Thanks,
Neo

So do we really need to avoid zero initialization with the modern GCC,
since the kernel source implicitly allows GCC-only extensions anyway?

 

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ




--
I would remember that if researchers were not ambitious
probably today we haven't the technology we are using!

[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux