the momory location of static variables and constant integer

the momory location of static variables and constant integer

Post by Kim, Jeong-Hwa » Sat, 18 Jan 2003 17:33:36



Hi, everyone

Could you tell me memory section, "bss", "data", or etc., do the static
variables and
constant integers belong to ?

Thanks in advance
Kim

 
 
 

the momory location of static variables and constant integer

Post by Davi » Tue, 21 Jan 2003 11:22:41



says...

Quote:> Hi, everyone

> Could you tell me memory section, "bss", "data", or etc., do the static
> variables and
> constant integers belong to ?

> Thanks in advance
> Kim

Constants belong to the .text section.

Static variables will either be in .data or .bss depending if they are
initialized or not.  If they are initialized (example: static int var =
1;) then they will be in .data.  If they are not initialized then they
will be in .bss.

...david

 
 
 

the momory location of static variables and constant integer

Post by Vasu Dal » Tue, 21 Jan 2003 17:30:48


Hello:

Quote:> > Could you tell me memory section, "bss", "data", or etc., do the static
> > variables and
> > constant integers belong to ?

> Constants belong to the .text section.

> Static variables will either be in .data or .bss depending if they are
> initialized or not.  If they are initialized (example: static int var =
> 1;) then they will be in .data.  If they are not initialized then they
> will be in .bss.

To add more to what was said earlier...

Use the "size" command. man size on Unix/Linux.

For example for a Power PC (8260) BSP, the command is: sizeppc

-> sizeppc vxWorks <enter>

This will give u a listing of the size of each of the sections
for the image with filename "vxWorks".

hth,
vasu