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]
Other format: [Raw text]

Re: gcc puts .data and .bss symbols in .text segment.


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


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