手动运行gcc的步骤,编译,汇编,链接 [英] Running gcc's steps manually, compiling, assembling, linking
本文介绍了手动运行gcc的步骤,编译,汇编,链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如果你有一个简单的C程序,如
If you have a simple C program, like
int main(void) {return 0;}
它可以与的gcc -o测试test.c的
。
据我了解,GCC编译执行,组装则链接。后两个步骤都是由它运行实现为
和 LD
。
As I understand, gcc performs compiling, assembling then linking. The latter two steps are achieved by it running as
and ld
.
我可以使用的gcc -S test.c以
生成大会code。
I can generate the assembly code by using gcc -S test.c
.
您会键入的内容到终端,到装配code转换成可执行?
What would you type into a terminal, to convert the assembly code into an executable?
(这样做的原因是为了学习组件)
(the reason for doing so is to learn assembly)
推荐答案
这是使用gcc的不同阶段
These are the different stages using gcc
gcc -E --> Preprocessor, but don't compile
gcc -S --> Compile but don't assemble
gcc -c --> assemble but don't link
gcc with no switch will link your object files and generate the executable
这篇关于手动运行gcc的步骤,编译,汇编,链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文