Four stages of compilation process
Pre-processor
We use a high level language such as C++ to write our source code which ends with extensions .c, .cpp, .h etc. The C++ preprocessor removes the comments, copies the contents of the included header files into the source code file, generates macro code, and replaces symbolic constants defined using #define
with their values.
gcc -E hello.c -o hello.i
Compiler
The expanded source code is compiled into the assembly language for the platform. This is the final human readable form.
gcc -Wall -S hello.i -o hello.s
Assembler
The assembly code is transformed into the object code for the platform.
as hello.s -o hello.o
Linker
The object code file generated by the assembler is linked together with the object code files for any library functions used to produce an executable file. The extra linking files provide information such as from which address to start the execution, i.e. the entry point
ld -dynamic-linker /lib/ld-linux.so.2/usr/lib/crt1.o /usr/lib/crti.o /usr/lib/gcc-lib/i686/3.3.1/crtbegin.o-L/usr/lib/gcc-lib/i686/3.3.1 hello.o -lgcc -lgcc_eh -lc -lgcc -lgcc_eh/usr/lib/gcc-lib/i686/3.3.1/crtend.o /usr/lib/crtn.o == gcc hello.o
I think this is a real great article. Really looking forward to read more. Awesome. Angeline Claudius Krell
Looking forward to reading more. Great post. Really looking forward to read more. Cool. Nicolina Bancroft Kemp
You made some decent factors there. I searched the net for the issue and found most individuals will accompany with your web site. Trisha Emmerich Bach
I value the post. Really looking forward to read more. Want more. Di Alonso Corin
I just like the valuable information you provide on your articles. Liza Worden Newfeld
Wohh exactly what was searchng for, apprecate t for postng. Coralie Alisander Butch