i call glibc function, for example, printf:
mov $some_string, %rdi
call printf //<----crash
in some cases, such a call will crash. I add xor %rax, %rax this solves the problem.
I have two questions:
Why, in some cases, calling printf without xor %rax leads to a crash, and in some it does not?
Somewhere I saw such a call printf:
lea some_string(%rip), %rdi xor %eax, %eax call printf
Why this used rip register and how is this passing of an argument different from the usual?