Skip to content

Instantly share code, notes, and snippets.

@vitaly-la
Created June 9, 2026 12:25
Show Gist options
  • Select an option

  • Save vitaly-la/8a11e0baff4acd2cde3cedae0107cad9 to your computer and use it in GitHub Desktop.

Select an option

Save vitaly-la/8a11e0baff4acd2cde3cedae0107cad9 to your computer and use it in GitHub Desktop.
Hello World in GNU Assembly (OpenBSD 7.9, x86-64)
# 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
@naltun

naltun commented Jun 23, 2026

Copy link
Copy Markdown

I'm revisiting amd64 Assembly programming on OpenBSD and this is a great example. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment