Created
June 9, 2026 12:25
-
-
Save vitaly-la/8a11e0baff4acd2cde3cedae0107cad9 to your computer and use it in GitHub Desktop.
Hello World in GNU Assembly (OpenBSD 7.9, x86-64)
This file contains hidden or 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
| # cc -nostdlib -no-pie -static helloworld.s -o helloworld && strip helloworld | |
| .section .rodata | |
| msg: | |
| .ascii "hello, world\n" | |
| len = . - msg | |
| .text | |
| .globl _start | |
| _start: | |
| mov $4, %eax | |
| mov $1, %edi | |
| mov $msg, %rsi | |
| mov $len, %rdx | |
| addr_write: | |
| syscall | |
| mov $1, %eax | |
| xor %edi, %edi | |
| addr_exit: | |
| syscall | |
| .section .openbsd.syscalls, "a" | |
| .long addr_write, 4 | |
| .long addr_exit, 1 | |
| .section .note.openbsd.ident, "a" | |
| .long 8, 4, 1 | |
| .ascii "OpenBSD\0" | |
| .long 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I'm revisiting
amd64Assembly programming on OpenBSD and this is a great example. Thank you!