最短 hello world elf

很久沒碰 linux 了,剛才玩了一下,看到了一個網頁
http://blog.linux.org.tw/~jserv/archives/001762.html
順便練了一下,由於我幾乎完全不懂組合語言和 elf 結構,所以
只是單純的修改了一下簡單的程式邏輯,改過之後長度從 115 降到 110



xor ebx, ebx ; zero ebx
lea eax, [byte ebx + 4] ; 4: write syscall
lea edx, [byte ebx + 13] ; 13: size of msgtext
inc ebx ; 1: (stdout)
mov ecx,msgtext ; msgtext: (output buffer)
int 0x80 ; syscall (write)
mov eax,ebx ; 1 exit syscal
dec ebx ; 0: successful exit code
int 0x80 ; syscall (exit)
msgtext: db 'Hello World!', 10


要能編譯,參考
http://www.muppetlabs.com/~breadbox/software/tiny/teensy.html
並且用上面的程式碼取代其中的
; your program here
應該還可以更短,因為我不太懂組合語言。