This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: bss section not getting zero-initialised vars


> 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.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]