Re: [LIP] ELF Format etc

Shehjar Tikoo <shehjar_tikoo-/[email protected]>
Newsgroups gmane.user-groups.linux.india.programmers
Message-ID <[email protected]>
Hi Sukrit

--- Sukrit K Mehra <holysmoke-asPoR4/t/[email protected]> wrote:
> hi,
hey!

> i have some confusions that i would like to sorted
> out. 
> for a program image, according to elf format we have
> following sections -
> 
> txt //code
> bss //unintialised data, like what? Is this RO or
> RW?
RW.RO wont let you write to your unitialised
variables. 

> data //initialised data, like static variables? Is
> this RO or RW?
RW.same again.

> Where does the program stack go?
In a separate section of the program's memory layout.
 
> Is the program Stack different from function stack?
No.Theres a just one stack for each program.

> Where is the heap?
Again in a separate section of the program's memory
layout.

> Global variables stored where? (Program stack?)
Heap.

> static variables are stored where?
Heap.

Please note that ELF is just the representation of the

program on the disk and not in the memory, the last 5
questions are more related to the memory layout of the

program, i.e. how and where it gets loaded as a 
process.

I suggest reading Advanced Programming in Unix
Environment by R. Stevens
It has a section on a program's memory layout.

Besides you should google for the process memory
layout in Linux and ELF format.

Hope that helps.
Shehjar



		
_______________________________
Do you Yahoo!?
Win 1 of 4,000 free domain names from Yahoo! Enter now.
http://promotions.yahoo.com/goldrush


-------------------------------------------------------
This SF.Net email is sponsored by BEA Weblogic Workshop
FREE Java Enterprise J2EE developer tools!
Get your free copy of BEA WebLogic Workshop 8.1 today.
http://ads.osdn.com/?ad_id=5047&alloc_id=10808&op=click
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.