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: etienne dot lorrain at ibm dot net, gcc at gcc dot gnu dot org
- Subject: Re: bss section not getting zero-initialised vars
- From: Mike Stump <mrs at windriver dot com>
- Date: Fri, 14 Jan 2000 17:13:38 -0800 (PST)
> Date: Fri, 14 Jan 2000 18:19:59 +0100 (CET)
> From: =?iso-8859-1?q?Etienne=20LORRAIN?= <etienne_lorrain@yahoo.fr>
> Reply-To: etienne.lorrain@ibm.net
> I am probably not getting something obvious, but in C (gcc-2.95.2
> or more, did not test before) my zero initialised variables are not
> set to the .bss section but to the .data section (as seen in
> assembler file).
Yes, this is true. gcc doesn't have the optimization where we move
zero inited things into bss.
> Looked at deja.com, found "-fconserve-space" on a
> 2 years + discussion on djgpp, it does not work here.
Yes, it does work, you just are using the case where it works.
> Does someone has a pointer to how to get
> int my_variable = 0;
> onto .bss section automatically, without using "int my_variable
> __attribute__((section("bss"))) = 0;" ?
Sure, remove the = 0 on it. Also, on my system (x86 linux) mine get
placed into bss all by themselves, meaning -fconserve-space on my
platform does nothing.