as 汇编器
[root@localhost ~]# cat .s
.file "write.s"
.section .rodata
hello: .string "hello, world!\n" .section .text
.global _start _start:
movl $, %eax # syscall number for write function
movl $, %ebx # standand for stdout
movl $hello, %ecx # the second argument of write function
movl $, %edx # the third argument of write function
int $0x80 # interrupt to call write
movl $, %eax # syscall number for sys_exit function
xorl %ebx, %ebx # the argument for sys_exit function
int $0x80 # interrupt to call sys_exit ret # return to the caller of the function
编绎:
as -o 1.o 1.s
链接:
ld -o 1 1.o
执行:
[root@localhost ~]# ./1
hello, world!
Usage: objdump <option(s)> <file(s)>
Display information from object <file(s)>.
At least one of the following switches must be given:
-a, --archive-headers Display archive header information
-f, --file-headers Display the contents of the overall file header
-p, --private-headers Display object format specific file header contents
-h, --[section-]headers Display the contents of the section headers
-x, --all-headers Display the contents of all headers
-d, --disassemble Display assembler contents of executable sections
-D, --disassemble-all Display assembler contents of all sections
-S, --source Intermix source code with disassembly
-s, --full-contents Display the full contents of all sections requested
-g, --debugging Display debug information in object file
-e, --debugging-tags Display debug information using ctags style
-G, --stabs Display (in raw form) any STABS info in the file
-W, --dwarf Display DWARF info in the file
-t, --syms Display the contents of the symbol table(s)
-T, --dynamic-syms Display the contents of the dynamic symbol table
-r, --reloc Display the relocation entries in the file
-R, --dynamic-reloc Display the dynamic relocation entries in the file
@<file> Read options from <file>
-v, --version Display this program's version number
-i, --info List object formats and architectures supported
-H, --help Display this information
[root@localhost ~]# objdump -D ./.o ./.o: file format elf64-x86- Disassembly of section .text: <_start>:
: b8 mov $0x4,%eax
: bb mov $0x1,%ebx
a: b9 mov $0x0,%ecx
f: ba 0e mov $0xe,%edx
: cd int $0x80
: b8 mov $0x1,%eax
1b: db xor %ebx,%ebx
1d: cd int $0x80
1f: c3 retq
Disassembly of section .rodata: <hello>:
: 6c 6c 6f pushq $0x6f6c6c65
: 2c sub $0x20,%al
: 6f ja <_start+0x78>
: 6c jb <_start+0x77>
b: 0a and %ecx,%fs:(%rdx)
...
http://blog.csdn.net/geekcome/article/details/6216634
as 汇编器的更多相关文章
- CSAPP读书随笔之一:为什么汇编器会将call指令中的引用的初始值设置为-4
CSAPP,即<深入理解计算机系统:程序员视角>第三版,是一本好书,但读起来确需要具备相当的基本功.而且,有的表述(中译文)还不太直白. 比如,第463页提到,(对于32位系统)为什么汇编 ...
- 3.1 as86汇编器
在开始讲述as86汇编器前,这本书引用内核中bootsect.s框架程序汇编代码来解释,记录下这一小段代码中不理解的地方,下面是这段实例代码: .globl begtext, begdata, beg ...
- A51汇编器的解释
A51汇编器是运行于IBM PC系列及其兼容机上的交叉汇编软件,其主要功能是将MCS-51系列单片机汇编语言源程序翻译成符合Intel目标文件格式的可再定位的目标代码,经过L51连接器的连接和装配,产 ...
- KEIL的宏汇编器A51介绍
A51是一种具有通用特性和用法的重定位宏汇编器.它与Intel公司的MASM51宏汇编器具有很好兼容性,支持模块化编程,可以方便地与高级语言接口.A51宏汇编器支持汇编伪指令.宏处理指令以及汇编控制命 ...
- 29 A Quick Guide to Go's Assembler 快速指南汇编程序:使用go语言的汇编器简介
A Quick Guide to Go's Assembler 快速指南汇编程序:使用go语言的汇编器简介 A Quick Guide to Go's Assembler Constants Symb ...
- 【原创】NES第一波:如何用通用型6502宏汇编器,制用NES/FC游戏。
在163的博客关了呀.在这边重新开张了. 以后若网友有什么要长篇解答的问题,也在这儿作答. 作为第一波原创文章,我打算做一次小白示范.那就是一步一步的展示某个汇编编译器的用法. 一.科普 很多人认为程 ...
- 基于ARM处理器的反汇编器软件简单设计及实现
写在前面 2012年写的毕业设计,仅供参考 反汇编的目的 缺乏某些必要的说明资料的情况下, 想获得某些软件系统的源代码.设计思想及理念, 以便复制, 改造.移植和发展: 从源码上对软件的可靠性和安全性 ...
- ARM 汇编器对C的扩展
__swi void ledtest(); //:声明 edtest 是个软中断. __asm 内嵌汇编 //:通常在C程序里面需要嵌入汇编代码,这是就可以用__asm关键字 ...
- ARM的ADS汇编器和GCC汇编器
一:ads下的一段汇编程序: __main EXPORT BootReset BootReset B resetvec_reqset ...
随机推荐
- 洛谷P1038神经网络
传送门啦 一个拓扑排序的题,感觉题目好难懂... #include <iostream> #include <cstdio> #include <cstring> ...
- Linux下LAMP服务器的搭建
1.安装并配置Apache 安装apache的方法有很多种,这里选择通过yum方式进行安装,但需要Linux系统能够连接互联网,执行如下命令,安装Apache. # yum install httpd ...
- php和mysql两种不同方式的分割字符串和类型转换
一.sql语句1.分割字符串方法:substring_index(字符串,'分隔符',正数从左数起几位/负数从右数起几位); 例如:subtring_index('aa_bb_cc_dd','_',1 ...
- springMVC源码分析--HttpMessageConverter数据转化(一)
之前的博客我们已经介绍了很多springMVC相关的模块,接下来我们介绍一下springMVC在获取参数和返回结果值方面的处理.虽然在之前的博客老田已经分别介绍了参数处理器和返回值处理器: (1)sp ...
- gtk+学习笔记(八)
框架(Frames)可以用于在盒子中封装一个或一组构件,框架本身还可以有一个标签.标签的位置和盒子的风格可以灵活改变. 框架可以用下面的函数创建: GtkWidget *gtk_frame_new( ...
- 使用Github的gh-pages分支展示一个页面
Github有一个Github pages的功能可以搭建博客或者托管网页,是免费使用的. 首先你的注册Github账号 下载安装git Github官网操作 登录到Github上,创建一个名为 Git ...
- 开源框架:SDWebImage
http://blog.csdn.net/uxyheaven/article/details/7909373 SDWebImage是我搞iOS以来少数佩服的框架,膜拜一下作者.真的写的非常棒! 这套开 ...
- moment.js笔记
增加日期时间 moment().add(Number, String); moment().add(Duration); moment().add(Object); 添加天数: moment().ad ...
- Dubbo中只订阅与只注册
一:只订阅 1.场景 为方便开发测试,经常会在线下共用一个所有服务可用的注册中心,这时,如果一个正在开发中的服务提供者注册,可能会影响消费者不能正常运行. 可以让服务提供者开发方,只订阅服务(开发的服 ...
- C#基础语法补充
[学习笔记]前接:https://www.cnblogs.com/aland-1415/p/7360509.html 一.异常处理 1.格式 try{ } catch{ } catch{ } ... ...