gcc 汇编

bss段总是在text段之前

_start 标签定义起点 ,连接器-e 参数可以定义新的起点

.global为外部程序提供入口点

.ascii 声明一个ASCII文本字符串

int $0x80  从linux内核访问控制台显示

gdb

info registers

print/d $ebx 十进制的值

print/t 二进制的值

print/x 十六进制值

x/nyz
where nis the number of fields to display, yis the format of the output, and can be
❑ cfor character
❑ dfor decimal
❑ xfor hexadecimal
and zis the size of the field to be displayed:
❑ bfor byte
❑ hfor 16-bit word (half-word)
❑ wfor 32-bit word

 

.asciz 在定义的字符串末尾加空字符

.lcomm

.data 数据段定义

.rodata  只读数据段定义

.ascii Text string
.asciz Null-terminated text string
.byte Byte value
.double Double-precision floating-point number
.float Single-precision floating-point number
.int 32-bit integer number
.long 32-bit integer number (same as .int)
.octa 16-byte integer number
.quad 8-byte integer number
.short 16-bit integer number
.single Single-precision floating-point number (same as .float)

定义static symbols

.equ factor, 3
.equ LINUX_SYS_CALL, 0x80

movl $LINUX_SYS_CALL, %eax  使用定义的symbos

bss section  不用定义类型

.comm Declares a common memory area for data that is not initialized
.lcomm Declares a local common memory area for data that is not initialized

posted @ 2014-08-24 21:58  anjsxz  阅读(220)  评论(0编辑  收藏  举报