Skip to content

Instantly share code, notes, and snippets.

@00-matt
Last active August 7, 2019 10:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 00-matt/931184021f32259f2f120e5ab277f29f to your computer and use it in GitHub Desktop.
Save 00-matt/931184021f32259f2f120e5ab277f29f to your computer and use it in GitHub Desktop.
x86_64 Linux ASM Example
.text
.global _start
_start:
mov $1, %rax # write(1, message, 14)
mov $1, %rdi
mov $message, %rsi
mov $14, %rdx
syscall
mov $60, %rax # exit(0)
xor %rdi, %rdi
syscall
.data
message:
.ascii "Hello, World!\n"
.PHONY: all
all: hello
hello: hello.o
$(LD) hello.o -o hello
hello.o: hello.S
$(AS) hello.S -o hello.o
.PHONY: clean
clean:
rm -f hello hello.o
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment