x86_64 calling conventions and stack frames

前端 未结 4 1477
孤独总比滥情好
孤独总比滥情好 2021-02-07 17:21

I am trying to make sense out of the executable code that GCC (4.4.3) is generating for an x86_64 machine running under Ubuntu Linux. In particular, I don\'t understand how the

4条回答
  •  傲寒
    傲寒 (楼主)
    2021-02-07 18:05

    I think the difference is that omitting the frame pointer is simply more encouraged in amd64. A footnote on page 16 of the abi says

    The conventional use of %rbp as a frame pointer for the stack frame may be avoided by using %rsp (the stack pointer) to index into the stack frame. This technique saves two instructions in the prologue and epilogue and makes one additional general-purpose register (%rbp) available.

    I don't know what GDB does. I assume that when compiled with -g, objects have magic debugging information that allows GDB to reconstruct what it needs. I don't think I've tried GDB on a 64-bit machine without debugging info.

提交回复
热议问题