Created
August 7, 2025 05:50
-
-
Save terremoth/34dafdea5b0d919c9d95c58089450a92 to your computer and use it in GitHub Desktop.
Hello World in assembly x64 using AT&T syntax
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
.section .data | |
msg: | |
.asciz "Hello, World!\n" | |
.section .text | |
.global main | |
main: | |
mov $1, %rax | |
mov $1, %rdi | |
lea msg(%rip), %rsi | |
mov $14, %rdx | |
syscall | |
mov $60, %rax | |
xor %rdi, %rdi | |
syscall |
Windows x64 MinGW64 version:
.section .data
msg:
.asciz "Hello, World!"
.section .text
.global main
.extern puts
main:
sub $40, %rsp
lea msg(%rip), %rcx
call puts
xor %eax, %eax
add $40, %rsp
ret
Compile (same way) with:
gcc hello.s -o hello.exe
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Compile: