Comment Comment by michidk I was able to shave off one additional byte with this: ... xor rax, rax ; = 0 inc rax ; = 1 - syscall: sys_write mov rdi, rax ; copy 1 - file descriptor: stdout lea rsi, [rel msg] ; pointer to message mov rdx, 14 ; message length syscall ... $ nasm -f bin -o elf elf.asm; wc -c elf; ./elf 166 elf Hello, World! So I guess NASM already optimizes this quite wellHowever, using the stack-based instructions as xpasky hinted at: ... push 1 ; syscall: sys_write pop rax pop rdi ; copy 1 - file descriptor: stdout lea rsi, [rel msg] ; pointer to message push 14 ; message length pop rdx syscall ... I get down to 159 bytes! I updated the article to reflect that parent michidk 1 year ago
However, using the stack-based instructions as xpasky hinted at:
I get down to 159 bytes! I updated the article to reflect that