编译链接

1.预编译

gcc -E hello.c -o hello.i

g++ -E hello.cpp -o hello.ii   

 + 将所有的#define宏展开

+ 处理所有预编译指令,包括#if, #ifdef, #elif, #else, #endif

+ 处理#include指令,将所包含的文件插入到预编译指令的位置

+ 删除所有注释

+ 添加行号和文件名标识

+ 保留所有的#pragma编译器指令

2.编译

gcc -S hello.i -o hello.s
gcc -S hello.c -o hello.s
/usr/lib/i486-linux-gnu/4,1/ccl hello.c

得到汇编

3.汇编

as hello.s -o hello.o
gcc -c hello.s -o hello.o
gcc -c hello.c -o hello.o

as为汇编器

4.链接

 

posted @ 2020-10-27 17:28  尘归风  阅读(107)  评论(0)    收藏  举报