- build
- 预编译preprosssing .li
- 编译compilation (预编译+编译 cc1,cc1plus)
- 词法分析lex
- 语法分析yacc
- 语义分析
- 中间代码生成及优化
- 目标代码生成及优化
- 汇编assembly as .o
- 链接linking ld .out
- Preprocessing
- 删除#define
- 处理#if等
- 处理#include,将对应文件插入
- 删除注释
- 添加行号和文件名标识
- 保留#pragma
- 在语法树上做优化比较困难,所以编译器往往将目标代码转化为中间代码,如三地址码再进行优化。
- Linking
- Address and Storage Allocation
- Symbol Resolution
- Relocation
- relocation entry