I had an assigment to translate a C code to Assembly intel syntax x86.
int a;
void fg(){
a=2;
}
int main(){
fg();
return a;
}
The result was this:
fg:
push rbp
mov rbp, rsp
mov DWORD PTR a[rip], 2
pop rbp
ret
main:
push rbp
mov rbp, rsp
mov eax, 0
call fg
mov eax, DWORD PTR a[rip]
pop rbp
ret
Could someone explain to me how does the addressing of a global variable work?
And what does a[rip]
means exactly?