Are the prologue and epilogue mandatory when writing assembly functions?

前端 未结 2 885
独厮守ぢ
独厮守ぢ 2021-01-18 05:16

Recently I rewrote some libc functions in assembly and for some of them (the one that didn\'t need any call or syscall instructions, like strlen), I discar

2条回答
  •  孤城傲影
    2021-01-18 06:09

    If you do not set up a proper stack frame, it can be hard for a debugger to know what function you are in right now. On ELF-targets, you have to manually provide CFI data (cf. this article) if you do not explicitly set up a stack frame. Without CFI data, stack unwinding doesn't work and the debugger might not be able to find out what function you are in. Unless you want to manually add CFI data (which is somewhat tedious and easy to get wrong), I recommend you to accept the minor performance loss and just set up a full stack frame.

提交回复
热议问题