(before any misconceptions may arise, I'm not talking about the linkage of libraries.)
In my textbook (about MIPS assembly), the following is stated:
Procedure/Function frame (aka activation record)
- Used by some compilers to manage stack storage
- In addition to Stack Pointer, use Frame Pointer register $fp to keep track of all pertinent information on the stack pertaining to a procedure/function invocation.
Caller side:
- Caller pushes arguments on the stack (or passes them via $a0 - $a3 if not more than 4 arguments)
- Caller reserves space on the stack for return values (or they are returned via $v0 - $v1)
- Caller passes static link (address on the stack of the nearest occurrence of the next lexically enclosing procedure/function) via $v0
(goes on about callee side etc...)
It was hard for me to understand the dynamic links in MIPS (frame pointers etc) because I couldn't find out why one would need that. Eventually I found out that they are not needed at all, it just comes in handy when debugging.
I feel similar about these static links, can someone explain to me what they are used for (preferably with an example)?