[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 汇编器的更多相关文章

  1. CSAPP读书随笔之一:为什么汇编器会将call指令中的引用的初始值设置为-4

    CSAPP,即<深入理解计算机系统:程序员视角>第三版,是一本好书,但读起来确需要具备相当的基本功.而且,有的表述(中译文)还不太直白. 比如,第463页提到,(对于32位系统)为什么汇编 ...

  2. 3.1 as86汇编器

    在开始讲述as86汇编器前,这本书引用内核中bootsect.s框架程序汇编代码来解释,记录下这一小段代码中不理解的地方,下面是这段实例代码: .globl begtext, begdata, beg ...

  3. A51汇编器的解释

    A51汇编器是运行于IBM PC系列及其兼容机上的交叉汇编软件,其主要功能是将MCS-51系列单片机汇编语言源程序翻译成符合Intel目标文件格式的可再定位的目标代码,经过L51连接器的连接和装配,产 ...

  4. KEIL的宏汇编器A51介绍

    A51是一种具有通用特性和用法的重定位宏汇编器.它与Intel公司的MASM51宏汇编器具有很好兼容性,支持模块化编程,可以方便地与高级语言接口.A51宏汇编器支持汇编伪指令.宏处理指令以及汇编控制命 ...

  5. 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 ...

  6. 【原创】NES第一波:如何用通用型6502宏汇编器,制用NES/FC游戏。

    在163的博客关了呀.在这边重新开张了. 以后若网友有什么要长篇解答的问题,也在这儿作答. 作为第一波原创文章,我打算做一次小白示范.那就是一步一步的展示某个汇编编译器的用法. 一.科普 很多人认为程 ...

  7. 基于ARM处理器的反汇编器软件简单设计及实现

    写在前面 2012年写的毕业设计,仅供参考 反汇编的目的 缺乏某些必要的说明资料的情况下, 想获得某些软件系统的源代码.设计思想及理念, 以便复制, 改造.移植和发展: 从源码上对软件的可靠性和安全性 ...

  8. ARM 汇编器对C的扩展

    __swi void ledtest();    //:声明 edtest 是个软中断. __asm  内嵌汇编          //:通常在C程序里面需要嵌入汇编代码,这是就可以用__asm关键字 ...

  9. ARM的ADS汇编器和GCC汇编器

    一:ads下的一段汇编程序: __main  EXPORT BootReset  BootReset                 B resetvec_reqset                 ...

随机推荐

  1. Apache Lucene版本迁移指南

    http://lucene.apache.org/core/4_0_0/MIGRATE.html 本文详细介绍了lucene的版本升级过程中的重大改进与调整. 比如:灵活的索引改变了低水平的域.词.文 ...

  2. java 闭包与回调

    闭包(closure)是一个可调用的对象,它记录了一些信息,这些信息来自于创建它的作用域. 内部类是面向对象的闭包,因为它不仅包含外围类对象(创建内部类的作用域)的信息,还自动拥有一个指向此外围类对象 ...

  3. NYOJ 石子合并(一)(区间DP)

    题目链接:http://acm.nyist.edu.cn/JudgeOnline/problem.php?pid=737 题目大意: 有N堆石子排成一排,每堆石子有一定的数量.现要将N堆石子并成为一堆 ...

  4. python类型学习

    python类型学习 标准类型 数字 Integer 整型 Boolean 布尔型 Long integer 长整型 Floating point real numer  浮点型 Complex nu ...

  5. 对于ElasticSearch与Hadoop是如何互相调用的?

    1.在HDFS中,数据是以文件形式保存的,比如JSON: https://blog.csdn.net/napoay/article/details/68945483 2.python读写HDFS,一般 ...

  6. SQL中的注释语句

    SQL中的注释分为单行注释和多行注释.顾名思义,单行注释就是对一行进行注释,多行注释就是同时对多行进行注释. 一.单行注释 SQL语句中的单行注释使用 -- create database datab ...

  7. 按书上学写测试pytest

    慢慢的,这块知识也补好吧. 系统的学习框架,具体的细节,可以边百度边实现. test_three.py '''Test the Task data type.''' from collections ...

  8. PHP开发命名规范

    命名规范 ThinkPHP5遵循PSR-2命名规范和PSR-4自动加载规范,并且注意如下规范: 目录和文件 目录使用小写+下划线: 类库.函数文件统一以.php为后缀: 类的文件名均以命名空间定义,并 ...

  9. Redis keys命令

    序号 命令及描述 1 DEL key该命令用于在 key 存在时删除 key. 2 DUMP key 序列化给定 key ,并返回被序列化的值. 3 EXISTS key 检查给定 key 是否存在. ...

  10. 解决mysql中limit和in不能同时使用的问题

    先给出数据表 CREATE TABLE `test_tb_grade` ( `ID` ) NOT NULL AUTO_INCREMENT, `) DEFAULT NULL, `COURSE` ) DE ...