Problem with static and global data initialization

Venkata, Bulusu (IE10) Venkata.Bulusu@honeywell.com
Thu May 22 09:21:00 GMT 2003


Hi,
   Thanks for the reply. I have my own startup which is linked with the
application and other necessary files(like the crt0.o). So I'm sure that the
necessary functions are called(I've even taken the objdump of the exe to see
the contents of the memory where the variable is defined and it is correct).
The weird thing is that the bss section initialization is working and data
section initialization isn't.

Thanks and Regards,
Sudhakar 

" This e-mail, and any attachments thereto, are intended only for use by the
addressee(s) named herein and contain Honeywell confidential information. If
you are not the intended recipient of this e-mail, you are hereby notified
that any dissemination, distribution or copying which amounts to
misappropriation of this e-mail and any attachments thereto, is strictly
prohibited. If you have received this e-mail in error, please immediately
notify me and permanently delete the original and any copy of any e-mail and
any printout thereof." 


-----Original Message-----
From: Erik Christiansen [mailto:erik@dd.nec.com.au]
Sent: Thursday, May 22, 2003 14:19
To: Venkata, Bulusu (IE10)
Cc: gcc-help@gcc.gnu.org
Subject: Re: Problem with static and global data initialization


On Thu, May 22, 2003 at 12:21:21PM +0530, Venkata, Bulusu (IE10) wrote:
> I've even tried to have my own ld
> linker script which defines the different sections and also wrote the
> initialization code in the file ctr0.o(i.e. making the ".bss" data all
> zeroes and copying all ".data" section info into RAM). 

   You're on the right track. Once you have provided and linked crt0.o,
   you'll need to ensure that it is called. Have you provided the label
   _start for the standard startup to call? I'm just going on the
   following in the GCC Manual:

>>>
-nostartfiles
   Do not use the standard system startup files when linking. (e.g. crt0.o,
with
   _start) The standard system libraries are used normally, unless -nostdlib
or
   -nodefaultlibs is used.
<<<

   There has to be better documentation somewhere, but I gave up
   googling before finding it.

Regards,
Erik



More information about the Gcc-help mailing list