Skip to content

Instantly share code, notes, and snippets.

@flysand7
Created June 16, 2025 08:14
Show Gist options
  • Save flysand7/8f7d2af80f41fa3395863d8ee547edea to your computer and use it in GitHub Desktop.
Save flysand7/8f7d2af80f41fa3395863d8ee547edea to your computer and use it in GitHub Desktop.
Raw-doggin' hello world (x86-64-linux-unknown)
# ELF FILE HEADER
# ----
7f454c46 # EI_MAG0..3 = '\x7fELF'
02 # EI_CLASS = ELFCLASS64[02]
01 # EI_DATA = ELFDATA2LSB[01]
01 # EI_VERSION = EV_CURRENT[01]
00 # EI_OSABI = ELFOSABI_SYSV[00]
00 # EI_ABIVERSION = 0(SystemV ABI version)
000000 00000000 # <padding> = 0
0200 # e_type(h) = ET_EXEC[02]
3e00 # e_machine(h) = EM_X86_64[3e]
01000000 # e_version(w) = EV_CURRENT[01]
00130000 01000000 # e_entry(a) = 100001300h
40000000 00000000 # e_phoff(o) = 40 (64 bytes, right after the ELF Header)
00000000 00000000 # e_shoff(o) = 0
00000000 # e_flags(w) = 0
4000 # e_ehsize(h) = 40h (64 bytes)
3800 # e_phentsize(h) = 38h (56 bytes)
0200 # e_phnum(h) = 2 program header
0000 # e_shentsize(h) = 0
0000 # e_shnum(h) = 0
0000 # e_shstrndx(h) = 0
# PROGRAM HEADER TABLE, ENTRY 0 [LOAD, +RW] (.data)
# ----
01000000 # p_type(w) = PT_LOAD[01]
06000000 # p_flags(w) = PF_W[2] | PF_R[4]
00020000 00000000 # p_offset(o) = 200h
00020000 01000000 # p_vaddr(a) = 100000200h
00020000 01000000 # p_paddr(a) = 100000200h
00010000 00000000 # p_filesz(xw) = 100h (256 bytes)
00010000 00000000 # p_memsz(xw) = 100h (256 bytes)
00010000 00000000 # p_align(xw) = 100h (256 bytes)
# PROGRAM HEADER TABLE, ENTRY 1 [LOAD, +RX] (.text)
# ----
01000000 # p_type(w) = PT_LOAD[01]
05000000 # p_flags(w) = PF_X[1] | PF_R[4]
00030000 00000000 # p_offset(o) = 300h
00130000 01000000 # p_vaddr(a) = 100001300h
00130000 01000000 # p_paddr(a) = 100001300h
00000100 00000000 # p_filesz(xw) = 10000h (64 KiB)
00000100 00000000 # p_memsz(xw) = 10000h (64 KiB)
00010000 00000000 # p_align(xw) = 100h (256 bytes)
# ---
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
# OFFSET: 100h
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
# OFFSET: 200h
# ---
# SEGMENT 1 DATA (.data)
# ----
48 65 6c 6c 6f 2c 20 57 6f 72 6c 64 21 0a 00 00 # "Hello, World!"
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
# OFFSET: 300h
# ---
# SEGMENT 2 DATA (.text)
# ----
b8 01000000 # MOV EAX, 1
bf 01000000 # MOV EDI, 1
48be 0002000001000000 # MOV RSI, 0x100000200
ba 0e000000 # MOV RDX, 14
0f05 # SYSCALL [write, fd=1, buf="Hello, World!\n", count=14
b8 e7000000 # MOV EAX, 0xe7
bf 00000000 # MOV EDI, 0
0f05 # SYSCALL [exit_group, exit_code = 0]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment