Quantcast
Channel: Active questions tagged gcc - Stack Overflow
Viewing all articles
Browse latest Browse all 21994

Understanding gcc -S output

$
0
0

I did gcc -S on the very complex program below on x86_64:

int main() {    int x = 3;    x = 5;    return 0;}

And what I got was:

       .file   "main.c"        .text.globl main        .type   main, @functionmain:.LFB0:        .cfi_startproc        pushq   %rbp        .cfi_def_cfa_offset 16        .cfi_offset 6, -16        movq    %rsp, %rbp        .cfi_def_cfa_register 6        movl    $3, -4(%rbp)        movl    $5, -4(%rbp)        movl    $0, %eax        leave        .cfi_def_cfa 7, 8        ret        .cfi_endproc.LFE0:        .size   main, .-main        .ident  "GCC: (GNU) 4.4.7 20120313 (Red Hat 4.4.7-3)"        .section        .note.GNU-stack,"",@progbits

I was wondering if someone could help me understand the output or refer me to some link explaining. Specifically, What does cfi ,LFB0,LFE0 , leave mean? All I could find regarding these is this post but couldn't fully understand what it was for. Also, what does ret do in this case? I'm guessing it's returning to __libc_start_main() which in turn would call do_exit() , is that correct?


Viewing all articles
Browse latest Browse all 21994

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>