I'm having trouble understanding why my code causes segmentation fault.
.section .rdata
format:
.asciz "Hello world\n"
.text
.globl main
main:
pushq %rbp
leaq format(%rip), %rcx
call printf
popq %rbp
ret
This is a simple assembly code that I wrote, and I compiiled using the following command using GCC in 64-bit windows.
gcc hello.s
After printing Hello world followed by a newline, the program crashes with Segmentation fault due to STATUS_ACCESS_VIOLATION. Is there anything wrong with my code?