Last active
April 3, 2018 11:12
-
-
Save kuuote/d4dfc79c4787802aa99cca4764ee4550 to your computer and use it in GitHub Desktop.
本物のプログラマはlibcを使わない[要出典]のでlibcレスHelloworld
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#required x86-64 linux | |
#as -o hello.o hello.s | |
#ld -o hello -dynamic-linker (path to ld-linux...) hello.o | |
#./hello | |
.global hello | |
.global _start | |
.data | |
hello: | |
.string "Hello world!\n" | |
helloend: | |
.equ len, helloend - hello | |
.text | |
_start: | |
movq $1, %rax #sys_write | |
movq $1, %rdi #stdout | |
movq $hello, %rsi #head of hello | |
movq $len, %rdx #length helloend - hello | |
syscall | |
movq $60, %rax #sys_exit | |
movq $0, %rdi #normal exit code | |
syscall | |
#real programmers don't use return |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment