I’m wondering if it makes sense to push the return value of a function in its the stack-frame.
I know return values are mostly stored in registers (eax for gcc), but is it for performance only?
Thanks!
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
it makes sense, but it must be manually inserted (and not a simple push). the ‘space’ for it should be ‘allocated’ by the caller (it must decrease sp before calling the function) because when you return from the function – the return address must be at the top of the stack, so the return value should be below the return address. [same principle as passing arguments on stack]