-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 ...
随机推荐
- 【poj1007】 DNA Sorting
http://poj.org/problem?id=1007 (题目链接) 题意 给出m个字符串,将其按照逆序对个数递增输出. Solution 树状数组经典应用. 代码 // poj1007 #in ...
- BZOJ4590 自动刷题机
Description 曾经发明了信号增幅仪的发明家SHTSC又公开了他的新发明:自动刷题机--一种可以自动AC题目的神秘装置.自动 刷题机刷题的方式非常简单:首先会瞬间得出题目的正确做法,然后开始写 ...
- php中单例模式的解析说明
<?php //单例模式 class Dbconn{ private static $_instance=null; protected static $_counter=0; protecte ...
- 用多态来实现U盘,Mp3,移动硬盘和电脑的对接,读取写入数据。
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.T ...
- redis哨兵配置主从
redis哨兵的启动和redis实例的启动没有关系.所以可以在任何机器上启动redis哨兵.至少要保证有两个哨兵在运行,要不然宕机后哨兵会找不到主节点. 配置步骤: 1.在redis的配置文件中添加鉴 ...
- 用80x86汇编语言编程:1 + 2 + 3 + 4 + 5 + …… + n,和小于100,在屏幕上显示次数和结果。
;============================================== ;1+...+n < 100 ;--------------------------------- ...
- Hibernate unsaved-value 属性
Session的saveOrUpdate方法是由Hibernate来判断被操作对象究竟是一个持久化对象还是临时自由状态对象.这需要在对象映射文件的主键id中定义unsaved-value属性,如果不显 ...
- ExtJS学习之路第六步:深入讨论组件Panel用法
Panel加载页面 var myPanel=Ext.create('Ext.panel.Panel',{ bodyPadding: "15px 10px 0 10px", titl ...
- git 笔记- 概念
本文参考书中内容 http://cnpmjs.org/ 镜像文件 下载插件的镜像 可参考fis 对于任何一个文件,在Git 内都只有三 种状态:已提交(committed),已修改(modified) ...
- Bootstrap速学教程之简要介绍
Bootstrap是Twitter推出的一个用于前端开发的开源工具包,由Twitter的设计师Mark Otto和Jacob Thornton合作开发,是一个CSS/HTML框架,不用请UI设计师也能 ...