This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: bss section not getting zero-initialised vars
- To: Jeffrey A Law <law at cygnus dot com>
- Subject: Re: bss section not getting zero-initialised vars
- From: Jamie Lokier <jamie dot lokier at cern dot ch>
- Date: Wed, 19 Jan 2000 16:08:43 +0100
- Cc: Richard Henderson <rth at cygnus dot com>, etienne dot lorrain at ibm dot net, gcc at gcc dot gnu dot org
- References: <20000119085656.A29146@pcep-jamie.cern.ch> <4146.948292688@upchuck>
Jeffrey A Law wrote:
> You might think that's not a good reason, but initializing a variable
> to zero to force it into .data so that it can be edited with adb,
> emacs, etc has been standard procedure on Unix systems for 20 years, I
> don't think we should change it. We did this kind of thing all the
> time in the BSD kernels.
Seeing as Emacs reckons that trick is "portable", right up to the most
recent version, I guess we'd better keep it that way.
A switch which defaults to off is a possibility. Maybe turned on by -Os?
Of course you're thinking that all real programs simply leave a variable
uninitialised if they want a zero, so why would it be an issue? Well,
maybe there are programs which initialise to a calculated value, which
may or may not be zero.
-- Jamie