#include
void fun(void) { printf("fun"); }
int main(int argc, char *argv[]){ fun(); return 0;} $ gcc -o test_ffp test.c $ gcc -fomit-frame-pointer -o test_ffp test.c
-rwxr-xr-x 1 Admin 40968 Jan 23 21:14 test.exe -rwxr-xr-x 1 Admin 40968 Jan 23 21:22 test_ffp.exe
$ gdb -q test.exe $ gdb -q test_ffp.exe
(gdb) disass main (gdb) disass main
Dump of assembler code for \
--ction main: Dump of assembler code for \
--ction main:
0x00401574 : push %ebp 0x00401573 : push %ebp
0x00401575 : mov %esp,%ebp 0x00401574 : mov %esp,%ebp
0x00401577 : and $0xfffffff0,%esp 0x00401576 : and $0xfffffff0,%esp
0x0040157a : call 0x401fb0 0x00401579 : call 0x401fb0
0x0040157f : call 0x401560 0x0040157e : call 0x401560
0x00401584 : mov $0x0,%eax 0x00401583 : mov $0x0,%eax
0x00401589 : leave 0x00401588 : leave
0x0040158a : ret 0x00401589 : ret
0x0040158b : nop 0x0040158a : nop
0x0040158c : xchg %ax,%ax 0x0040158b : nop
0x0040158e : xchg %ax,%ax 0x0040158c : xchg %ax,%ax
End of assembler dump. End of assembler dump. (gdb) disass fun (gdb) disass fun
Dump of assembler code for \
--ction fun: Dump of assembler code for \
--ction fun:
0x00401560 : push %ebp 0x00401560 : sub $0x1c,%esp
0x00401561 : mov %esp,%ebp 0x00401563 : movl $0x404024,(%esp)
0x00401563 : sub $0x18,%esp 0x0040156a : call 0x402738
0x00401566 : movl $0x404024,(%esp) 0x0040156f : add $0x1c,%esp
0x0040156d : call 0x402738 0x00401572 : ret
0x00401572 : leave End of assembler dump.
0x00401573 : ret (gdb)
End of assembler dump.
(gdb)

文件大小是一样,结果fun函数的汇编代码中push %ebp; leave; 没有啦.

05-11 09:37