Segmentation Fault caused in simple x86 NASM program

Viewed 26

test.asm:

global _start

section .text:

_start:
    mov rax, 0x4
    mov rbx, 1
    mov rcx, message
    mov rdx, message_len
    syscall

    mov rax, 0x1
    mov rbx, 0
    syscall

section .data:
    message: db "Hello, World!", 0xA
    message_len equ $-message

I assembled and linked the file using these commands

nasm -f elf64 -o hello_world.o test.asm
ld -m elf_x86_64 -o hello_world hello_world.o

When I run the executable it just causes a segmentation fault.

0 Answers
Related