This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils 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: wrong initialized global variable (in the wrong section: .bss instead of .data)


The initialization is not zero. And that's the
problem. In fact, a global looking like int foo=0;
would come up with an undidefined value, in the .bss.
I actually dig some more and it's not the linker
script, rather the compiler. The objdump shows me even
the .o file has the global in the .bss section. The
old compiler works fine: it puts it in .data section.
All initialized globals seem to be put in the .bss
with the exception of the globals initialized with a
constant (?).
For instance int foo=0; ends up in .bss
while
int foo1=TICK_1; ends up in .data
Again, the old gcc compiler sets all of them in .data.

Thanks,
Virgil

--- Alan Modra <amodra@bigpond.net.au> wrote:

> On Wed, Feb 09, 2005 at 12:26:53PM -0800, Virgil
> Anuichi wrote:
> > Right now all my initialized global variables end
> up
> > in the .bss section, which is wrong.
> 
> Is the initialization zero?  gcc
> -fno-zero-initialized-in-bss
> 
> -- 
> Alan Modra
> IBM OzLabs - Linux Technology Centre
> 



		
__________________________________ 
Do you Yahoo!? 
Take Yahoo! Mail with you! Get it on your mobile phone. 
http://mobile.yahoo.com/maildemo 


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