Home | Download | Documentation | Programming | FAQ | About Me
Executable File Format


const int b=1;
int c=2;
int main(){
int a;
char *sptr;

When It complied using gcc compiler. It produces an executable file.When it runs in RAM (it is called as process),executable file will have
text or code part,data part,stack and heap. Sample executable format will be of form :

Text or Code Section
	/*.text section (Contains executable code part ie. Machine language .Most OS 
	treats this code part  as read-only section ) */

Data part  (global variables)
/*.data section Contains either all initialized  Read-only data variables */
                          const int b=1;
/* or Contains all initialized  Read-Write data variables)*/

int c=2; /*.bss section(block started symbol- Contains all un- initialized data variables-It doesnít
occupy any space. Itís is not available in binary image but exists in primary memory (RAM)
when the binary is loaded)*/

char * sptr;
/* Contains all Local variables */
      int a;
/* Dynamically allocated memory created during malloc()*/
Powered by
Open Source Programmers