当前位置:网站首页>从源代码到可执行文件的过程
从源代码到可执行文件的过程
2022-04-23 05:46:00 【OceanKeeper1215】

1、预处理 gcc -c
- 将所有的”#define“删除,并且展开所有的宏定义
- 处理所有的条件编译指令,入“#if”,“ifdef”等。
- 处理#“include”预编译指令,将被包含的文件插入到预编译指令的位置
- 删除所有注释
2、编译
将预处理玩的文件进行一系列的语法分析和优化,产生相应的汇编代码文件
3、汇编
将变异完的汇编代码文件翻译成机器指令,并生成可重定位的.o文件,文件为二进制文件,字节编码是机器指令
4、链接 gcc -o
通过链接器将一个个目标文件及库文件连接在一起生成一个完成的可执行程序
链接程序的主要工作就是将有关的目标文件彼此相连接,也就是将在一个文件中引用的符号同该符号在另外一个文件中的定义连接起来,使得所有的这些目标文件成为一个能够被操作系统装入执行的统一整体。
版权声明
本文为[OceanKeeper1215]所创,转载请带上原文链接,感谢
https://blog.csdn.net/OceanKeeper1215/article/details/120978737
边栏推荐
- [leetcode 67] sum of two binary numbers
- Sakura substring thinking
- Linear algebra Chapter 2 - matrices and their operations
- List segmentation best practices
- Custom exception class
- Calculation (enter the calculation formula to get the result)
- Integration and induction of knowledge points of automatic control principle (Han min version)
- C language file operation
- Preparedstatement prevents SQL injection
- 线代第四章-向量组的线性相关
猜你喜欢
随机推荐
Chapter 3 of linear algebra - Elementary Transformation of matrix and system of linear equations
Doomsday (simple computational geometry)
D. Optimal partition segment tree optimization DP
The problem that the page will refresh automatically after clicking the submit button on the form is solved
Algèbre linéaire chapitre 1 - déterminants
ValueError: loaded state dict contains a parameter group that doesn‘t match the size of optimizer‘s
-- SQL query and return limit rows
[leetcode 67] sum of two binary numbers
Stability building best practices
POJ - 2955 brackets interval DP
What is the difference between the basic feasible solution and the basic feasible solution in linear programming?
Programming training
程序設計訓練
12. Monkeys climb mountains
Reading of denoising papers - [cvpr2022] blind2blind: self supervised image denoising with visible blind spots
[leetcode 19] delete the penultimate node of the linked list
JDBC operation transaction
Problems and solutions of database migration
Best practices for MySQL storage time
Delete and truncate









