-fomit-frame-pointer 编译选项在gcc 4.8.2版本中的汇编代码研究
#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; 没有啦.
-fomit-frame-pointer 编译选项在gcc 4.8.2版本中的汇编代码研究的更多相关文章
- 栈帧示意图:stack pointer、frame pointer
更多参考:http://www.embeddedrelated.com/usenet/embedded/show/31646-1.php 一: The calling convention descr ...
- frame pointer及其用途
1 什么是frame pointer frame pointer指向本函数栈帧顶,通过它可以找到本函数在进程栈中的位置.有专门的寄存器保存该值. 2 frame pointer有什么用 主要是back ...
- GCC 7.3.0版本编译http-parser-2.1问题
http-paser是一个用c编写的http消息解析器,地址:https://github.com/nodejs/http-parser,目前版本2.9 今天用gcc 7.3.0编译其2.1版本时,编 ...
- GCC 嵌入汇编代码
The format of basic inline assembly is very much straight forward. Its basic form is 基本汇编嵌入格式如下: asm ...
- GCC生成的汇编代码
假设我们写了一个C代码文件 code.c包含下面代码: int accum = 0; int sum(int x, int y){ int t = x + y; accum += t; return ...
- paip.提升用户体验-----c++ gcc 命令在notepad++扩展中的配置..
paip.提升用户体验-----c++ gcc 命令在notepad++扩展中的配置.. 作者Attilax , EMAIL:1466519819@qq.com 来源:attilax的专栏 地址: ...
- 测试一下robotgo自动化操作,顺便解决了原来的mingw版本中只有gcc,没有g++的问题
参考:https://gitee.com/veni0/robotgo#examples 但是编译不成功 找到这个:https://gitee.com/veni0/robotgo#examples ( ...
- 排查GCC 4.4.X版本优化switch-enum的BUG
起因 一次偶然碰到一个诡异的bug,现象是同一份C++代码使用GCC4.4.x版本在开启优化前和优化后的结果不一样,优化后的代码逻辑不正确. 示例代码如下: //main.cpp #include & ...
- gcc编译c中有与lua交互的代码
编译C程序中有与Lua有关的程序(编译环境是Linux系统,lua解释器是luajit)gcc -o test30 test30.cpp -I/usr/local/include/luajit-2.0 ...
随机推荐
- Oracle自定义函数实例
1. 传入一个值, 如果该值为0,则返回空. CREATE OR REPLACE FUNCTION Fun_Test(p IN NUMBER) RETURN VARCHAR2 IS v_Result ...
- BZOJ-3227 红黑树(tree) 树形DP
个人认为比较好的(高端)树形DP,也有可能是人傻 3227: [Sdoi2008]红黑树(tree) Time Limit: 10 Sec Memory Limit: 128 MB Submit: 1 ...
- Azure怎么使用ftp登录
1.下载配置文件 2.拷贝FTP的地址 3.查看配置文件里面的用户名和密码 4.登录
- [IOS Block和delegate的对比]
原文:http://blog.sina.com.cn/s/blog_9e8867eb0102uykn.html 这篇文章建议和前一篇一起看, 另外先弄清楚IOS的block是神马东东. 委托和bloc ...
- jsp学习(三)
<%@page contentType="text/html;charset=gbk"%> <html> <body> <font siz ...
- jboss7.1.1配置mysql数据源
http://blog.csdn.net/msz1992/article/details/8826754 #1.到http://www.mysql.com/downloads/connector/j/ ...
- SQL localdb 连接字符串
http://blog.csdn.net/greystar/article/details/47699797 原来SQL 2012 下连接LOCALDB,字符串为: Data Source=(Loca ...
- Visual Studio Online Integrations
...
- DEDECMS 后台登录空白怎么办 后台无法登陆
刚安装完dedecms,兴致冲冲的准备进后台,输入完用户名和密码后,页面 中显示一片空白. 立马到网上搜搜,发现大家各抒己见,但是都没有解决问题. 不过,下面的这个方法是可以的.马上记录下来,以备其他 ...
- Flume-NG内置计数器(监控)源码级分析
Flume的内置监控怎么整?这个问题有很多人问.目前了解到的信息是可以使用Cloudera Manager.Ganglia有图形的监控工具,以及从浏览器获取json串,或者自定义向其他监控系统汇报信息 ...