Sunday, July 22, 2012

Compileing Stages

Step1:- Source file-------------------------------------------------------->.c File

#gcc<space>-E<space>.c filename<space>-o<space>targetfilename1.i

By using -E flag preprocessor is invoked 

#gcc -E Hello.c -o Hello.i

#vim Hello.i file


Step2:-Preprocessor file------------------------------------------------>.i File

#gcc<space>-S<space>targetfilename1.i<space>-o<space>targetfilename2.s

By using -S flag Compiler is invoked

 

Step3:-Assembly file---------------------------------------------------->.s File

#gcc<space>-c<space>targetfilename2.s<space>-o<space>targetfilename3.o

By using -c flag Assembler is invoked to generate Relocatable file.


Step4:-Relocatable file------------------------------------------------>.o File

#gcc<space>targetfilename3.o<space>-o<space>targetfilename.

Finally Executable file will be created.

No comments:

Post a Comment