ARM: link register and frame pointer

后端 未结 2 1393
逝去的感伤
逝去的感伤 2020-11-22 09:36

I\'m trying to understand how the link register and the frame pointer work in ARM. I\'ve been to a couple of sites, and I wanted to confirm my understanding.

Suppos

2条回答
  •  执笔经年
    2020-11-22 09:54

    Disclaimer: I think this is roughly right; please correct as needed.

    As indicated elsewhere in this Q&A, be aware that the compiler may not be required to generate (ABI) code that uses frame pointers. Frames on the call stack can often require useless information to be put there.

    If the compiler options call for 'no frames' (a pseudo option flag), then the compiler can generate smaller code that keeps call stack data smaller. The calling function is compiled to only store the needed calling info on the stack, and the called function is compiled to only pop the needed calling information from the stack.

    This saves execution time and stack space - but it makes tracing backwards in the calling code extremely hard (I gave up trying to...)

    Info about the size and shape of the calling information on the stack is only known by the compiler and that info was thrown away after compile time.

提交回复
热议问题