gcc 编译 hello.c 的四个阶段

hello.c

#include <stdio.h>

int main()
{
    printf("hello, world!\n");
    return 0;
}

compilation

1. 预处理阶段:预处理器(cpp)

$ gcc -E hello.c -o hello.i
$ gcc -E -P hello.c -o hello.i

2. 编译阶段:编译器(ccl)

$ gcc -S hello.i -o hello.s

3. 汇编阶段:汇编器(as)

$ gcc -c hello.s -o hello.o

4. 链接阶段:链接器(ld)

$ gcc hello.o -o hello

frame

猜你喜欢

转载自www.cnblogs.com/typescript/p/11478937.html