furtherchan@ubuntu910:~$ ls
aaa.c Desktop examples.desktop Music Templates workspace
aaa.h Documents macrotest Pictures test.c 文档
apue_src.tar.gz Downloads macrotest.c Public Videos 桌面
furtherchan@ubuntu910:~$ gcc -E -o aaa.i aaa.c
furtherchan@ubuntu910:~$ ls
aaa.c Desktop examples.desktop Music Templates workspace
aaa.h Documents macrotest Pictures test.c 文档
aaa.i apue_src.tar.gz Downloads macrotest.c Public Videos 桌面
furtherchan@ubuntu910:~$ cat aaa.i
# 1 "aaa.c"
# 1 "<built-in>"
# 1 "<command-line>"
# 1 "aaa.c"
# 1 "/usr/include/stdio.h" 1 3 4
#......
# 3 "aaa.c" 2
# 1 "aaa.h" 1
typedef int integer;
# 4 "aaa.c" 2
int main()
{
integer i = 5;
printf("Integer i = %d/n",i);
return 0;
}
furtherchan@ubuntu910:~$ gcc -S -o aaa.s aaa.i
furtherchan@ubuntu910:~$ ls
aaa.c apue_src.tar.gz examples.desktop Pictures Videos
aaa.h Desktop macrotest Public workspace
aaa.i Documents macrotest.c Templates 文档
aaa.s Downloads Music test.c 桌面
furtherchan@ubuntu910:~$ cat aaa.s
.file "aaa.c"
.section .rodata
.LC0:
.string "Integer i = %d/n"
.text
.globl main
.type main, @function
main:
pushl %ebp
movl %esp, %ebp
andl $-16, %esp
subl $32, %esp
movl $5, 28(%esp)
movl $.LC0, %eax
movl 28(%esp), %edx
movl %edx, 4(%esp)
movl %eax, (%esp)
call printf
movl $0, %eax
leave
ret
.size main, .-main
.ident "GCC: (Ubuntu 4.4.1-4ubuntu9) 4.4.1"
.section .note.GNU-stack,"",@progbits
furtherchan@ubuntu910:~$ gcc -c aaa.s -o aaa.o
furtherchan@ubuntu910:~$ ls
aaa.c aaa.s Downloads Music test.c 桌面
aaa.h apue_src.tar.gz examples.desktop Pictures Videos
aaa.i Desktop macrotest Public workspace
aaa.o Documents macrotest.c Templates 文档
furtherchan@ubuntu910:~$ gcc aaa.o -o aaa
furtherchan@ubuntu910:~$ ./aaa
Integer i = 5