What is .cfi and .LFE in assembly code produced by GCC from c++ program?

前端 未结 1 1717
夕颜
夕颜 2021-01-30 13:40

I have the following c++ code

int factorial(int n){

    if(n==0){
        return 1;
    }
    return n*factorial(n-1);

}

int main(void){
    factorial(5);
            


        
相关标签:
1条回答
  • 2021-01-30 14:15

    These directives tell gas to emit Dwarf Call Frame Information tags which are apparently used to reconstruct a stack backtrace when a frame pointer is missing. In your case the frame pointer is present, so I guess it could be used to perform unwinding during exception handling. Such mechanism has less overhead than the old sjlj (setjump/longjump) one. See here, and also the linked Dwarf spec.

    As for .Lxx labels, .L prefix indicates that the label is local to this file and so will not conflict with the same-name labels in other files. GCC generally uses .L for auto-generated labels. In this case most likely "FB" means "function begin" and "FE" means "function end".

    0 讨论(0)
提交回复
热议问题