This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: global variables in C++ in .data
- To: "Michel van Elk" <michel at formula dot nl>
- Subject: Re: global variables in C++ in .data
- From: Alexandre Oliva <aoliva at redhat dot com>
- Date: 09 Aug 2000 06:21:29 -0300
- Cc: <help-gcc at gnu dot org>
- Organization: GCC Team, Red Hat
- References: <002e01c001de$8481f210$2b5d6dc2@michel>
On Aug 9, 2000, "Michel van Elk" <michel@formula.nl> wrote:
> When I put global variables in a C++ file and compile em with gcc they
> are put in the .data section. In my case this means ROM
This is wrong. `.rodata' should be ROM, but `.data' is supposed to be
RAM.
> Does anyone know how to get these globals in the .bss section?
Only uninitialized variables go in `.bss'.
> If I rename the file to .C the variable is put in the .bss section,
> just as I would expect.
The semantics of initialization in C and C++ are different.
--
Alexandre Oliva Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer aoliva@{cygnus.com, redhat.com}
CS PhD student at IC-Unicamp oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist *Please* write to mailing lists, not to me