This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: gcc puts .data and .bss symbols in .text segment.
- From: Jim Wilson <wilson at tuliptree dot org>
- To: Henrik Stokseth <hensto at online dot no>
- Cc: gcc at gcc dot gnu dot org
- Date: Wed, 18 Jun 2003 16:19:35 -0700
- Subject: Re: gcc puts .data and .bss symbols in .text segment.
- References: <3EEFF0B2.3000803@online.no>
Henrik Stokseth wrote:
Gcc puts symbols that should be
in .data or .bss into the .text segment instead. Why does Gcc do this,
and is this even allowed?
Yes, it is allowed. Read-only data goes in a .rodata section if it
exists, otherwise it goes in the .text section. If you are looking at
object files instead of gcc output, you might be assuming stuff is in
the text section that was actually in a different section to begin with,
and then merged with the text section by the assembler or linker.
How does one tell if a symbol is
code, bss or data??? I am using gcc 3.2.x.
This isn't a gcc question. It is a binutils question. There should be
info in the symbol table that can be used for this, at least in COFF. I
don't know OMF. Please send further questions to the
binutils@sources.redhat.com list.
Jim