-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 ...
随机推荐
- yii2图片上传
yii2利用自带UploadedFile上传图片 public static function uploadFile($name) { $uploadedFile = UploadedFile::ge ...
- MongoDB的安装及配置
MongoDB 是目前在IT行业非常流行的一种非关系型数据库(NoSql),其灵活的数据存储方式备受当前IT从业人员的青睐. Windows (1). 登录Mongodb官网点击下载 (2). 将zi ...
- spring获取ApplicationContext对象的方法——ApplicationContextAware
一. 引言 工作之余,在看一下当年学的spring时,感觉我们以前都是通过get~ set~方法去取spring的Ioc取bean,今天就想能不能换种模型呢?因为我们在整合s2sh时,也许有那么一天就 ...
- BZOJ4241 历史研究
Description IOI国历史研究的第一人——JOI教授,最近获得了一份被认为是古代IOI国的住民写下的日记.JOI教授为了通过这份日记来研究古代IOI国的生活,开始着手调查日记中记载的事件. ...
- window自动切换ip的脚本
因为总要切换ip,所以百度了一下脚本 如下http://jingyan.baidu.com/article/d2b1d1029d21b95c7e37d4fa.html 动态ip netsh inter ...
- php两种导出excel的方法
所需要的:jquery库,phpexcel插件,页面导出excel效果测试文件explode.php,excel导出功能实现文件exp.php和explode_excel.php,文件相关内容在此文下 ...
- 巧用jquery实现提交(submit)表单时候验证文本框是否为空
http://www.cnblogs.com/wifi/articles/2387131.html 先引用jquery Html部分--------------------------------- ...
- Java_观察者模式(Observable和Observer)
http://blog.csdn.net/tianjf0514/article/details/7475164/ 一.观察者模式介绍 在Java中通过Observable类和Observer接口实现了 ...
- JDK,JRE,JVM区别与联系(ZZ)
http://www.cnblogs.com/hencehong/p/3252166.html 我们开发的实际情况是:我们利用JDK(调用JAVA API)开发了属于我们自己的JAVA程序后,通过JD ...
- sleep()
经常看到线程中用sleep(),到底是什么用处,下面讲的比较通俗: 我们可能经常会用到 Thread.Sleep 函数来使线程挂起一段时间.那么你有没有正确的理解这个函数的用法呢?思考下面这两个问题: ...