Why do I get a segmentation fault from the following code?
.text
.globl start
start:
pushq %rbp
movq %rsp, %rbp
movq $0xBEEFF00DBEEFF00D, %rax
pushq %rax
movq $0xF00DBEEFF00DBEEF, %rax
pushq %rax
movq %rbp, %rsp
popq %rbp
ret
Error:
Segmentation fault: 11
If
startis your program’s entry point, you can’tretto OS; you should_exit.On Linux (x86-64) which you’re probably using, do this instead of
ret: