问题
int x=1;
int y=2;
int z=3;
turns into
movl $1, -4(%rbp)
movl $2, -8(%rbp)
movl $3, -12(%rbp)
What is the -4,-8,-12 for ? Why is it going by 4's? 4 bytes = 32 bits?
回答1:
-4 / -8 / -12 bytes relative to the address held in rbp
, which is the pointer to the top of the stack (which grows downward). 4 bytes / 32 bits because that is the size of int
on your machine.
来源:https://stackoverflow.com/questions/64122235/what-is-the-4-for-in-assembler-movl1-4rbp