Last active
August 7, 2019 10:20
-
-
Save 00-matt/931184021f32259f2f120e5ab277f29f to your computer and use it in GitHub Desktop.
x86_64 Linux ASM Example
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
.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" |
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
.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