1.The Preprocessor
expand macros and included header files.
cpp hello.c >> hello.i
2.The Compiler
preprocessed source code to assembly language,for a specific processor
gcc -Wall -S hello.i
3.The assembler
convert assembly language into machine code and generate an object file
as hello.s -0 hello.o
4.Linker
linking of object files to create an executeable,in practice,an executeable requires many external functions from system and c run-time(crt) libraries.
gcc hello.o
本文详细介绍了C程序从源代码到可执行文件的整个编译过程:预处理阶段进行宏展开与头文件包含;编译阶段将预处理后的源代码转换为特定处理器的汇编语言;汇编阶段把汇编语言转为机器码并生成目标文件;链接阶段将多个目标文件链接成可执行文件。

被折叠的 条评论
为什么被折叠?



