日期:2014-05-16 浏览次数:20986 次
.section .data
hello:
.asciz "Hello,world!\n"
.section .text
.global main
main:
push $hello
call printf
push $0
call exit
gcc gcctest.s -o gcctest.bin -g
$ gdb gcctest.bin Reading symbols from /data/code/asm/learn/linux/gcctest.bin...done. (gdb) disass _start Dump of assembler code for function _start: 0x08048360 <+0>: xor %ebp,%ebp 0x08048362 <+2>: pop %esi 0x08048363 <+3>: mov %esp,%ecx 0x08048365 <+5>: and $0xfffffff0,%esp 0x08048368 <+8>: push %eax 0x08048369 <+9>: push %esp 0x0804836a <+10>: push %edx 0x0804836b <+11>: push $0x80484a0 0x08048370 <+16>: push $0x8048430 0x08048375 <+21>: push %ecx 0x08048376 <+22>: push %esi 0x08048377 <+23>: push $0x8048414 0x0804837c <+28>: call 0x8048350 <__libc_start_main@plt> (gdb) disass main Dump of assembler code for function main: 0x08048414 <+0>: push $0x804a018 0x08048419 <+5>: call 0x8048320 <printf@plt> 0x0804841e <+10>: push $0x0 0x08048420 <+12>: call 0x8048340 <exit@plt>
gcc gcctest.s -o gcctest.bin -g -nostartfiles