The assembly code goes like this:
call next
next:
popl %eax
I thought after call next, the return address will be pushed onto the stack, right? But in the above code, what's the return address?
After that code executes %eax will have the address of label "next"
- the call branches to the target which happens to be the next sequential instruction and pushes the return address, which is always the address of the next sequential instruction
- the popl will pop the return address from the stack onto %eax register
The net effect is %eax points to label "next"
It's the address of the instruction immediately following the call instruction. See your CPU documentation on how call works.
来源:https://stackoverflow.com/questions/11462221/the-return-address-in-the-assembly-code