Source: /cirosantilli/elf-hello-world/generate-the-example

= Generate the example

Let's break down a minimal runnable Linux x86-64 example:

hello_world.asm

``
section .data
    hello_world db "Hello world!", 10
    hello_world_len  equ $ - hello_world
section .text
    global _start
    _start:
        mov rax, 1
        mov rdi, 1
        mov rsi, hello_world
        mov rdx, hello_world_len
        syscall
        mov rax, 60
        mov rdi, 0
        syscall
``

Compiled with:
``
nasm -w+all -f elf64 -o 'hello_world.o' 'hello_world.asm'
ld -o 'hello_world.out' 'hello_world.o'
``

TODO: use a minimal linker script with `-T` to be more precise and minimal.

Versions:
* NASM 2.10.09
* Binutils version 2.24 (contains `ld`)
* Ubuntu 14.04

We don't use a C program as that would complicate the analysis, that will be level 2 :-)