Assembly Language Getting started with Assembly Language Hello World for OS X (x86_64, Intel syntax gas)


Example

.intel_syntax noprefix

.data

.align 16
hello_msg:
    .asciz "Hello, World!"

.text

.global _main
_main:
    push rbp
    mov rbp, rsp

    lea rdi, [rip+hello_msg]
    call _puts

    xor rax, rax
    leave
    ret

Assemble:

clang main.s -o hello
./hello

Notes: