Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- GNU nano 2.2.6 Файл: hello32.s
- .text
- .global _start
- _start:
- push %esp
- push $print_fmt
- call printf
- movl $0, (%esp) # reuse the stack slots we set up for printf, inst$
- call exit # exit(3) does an fflush and other cleanup
- .section .rodata
- print_fmt: .asciz "Hello, World!\n%%esp at startup = %#lx\n"
- anthony:~/Dropbox/bero$ gcc -m32 -nostartfiles hello32.s
- anthony:~/Dropbox/bero$ ./a.out
- Hello, World!
- %esp at startup = 0xffd65ab0
- .data
- format: .asciz "hallo %d\n"
- .text
- .global main
- main:
- mov $format, %rdi
- # mov $1, %rsi # Writing to ESI zero extends to RSI.
- # xor %eax, %eax # Writing to EAX zero extends to RAX.
- call puts
- ret
- anthony:~/Dropbox/bero$ nano hello32.s
- anthony:~/Dropbox/bero$ gcc hello32.s
- anthony:~/Dropbox/bero$ ./a.out
- hallo %d
- anthony:~/Dropbox/bero$ nano hello32.s
- anthony:~/Dropbox/bero$ as -o hello32.o hello32.s
- anthonyd:~/Dropbox/bero$ ld -o hell -dynamic-linker /lib/x86_64-linux-gnu/ld-linux-x86-64.so.2 /usr/lib/x86_64-linux-gnu/crt1.o /usr/lib/x86_64-linux-gnu/crti.o -lc hello32.o /usr/lib/x86_64-linux-gnu/crtn.o
- anthony:~/Dropbox/bero$ ./hell
- hallo %d
- anthony:~/Dropbox/bero$
Add Comment
Please, Sign In to add comment