title: What are CFI directives in Gnu Assembler (GAS) used for?
body: <p>There seem to be a .CFI directive after every line and also there are wide varieties of these ex.,<code>.cfi_startproc</code> , <code>.cfi_endproc</code> etc..  <a href="https://sourceware.org/binutils/docs/as/CFI-directives.html#CFI-directives" rel="nofollow noreferrer">more here</a>.</p>
  <pre><code>    .file   &quot;temp.c&quot;
      .text
  .globl main
      .type   main, @function
  main:
  .LFB0:
      .cfi_startproc
      pushq   %rbp
      .cfi_def_cfa_offset 16
      movq    %rsp, %rbp
      .cfi_offset 6, -16
      .cfi_def_cfa_register 6
      movl    $0, %eax
      leave
      ret
      .cfi_endproc
  .LFE0:
      .size   main, .-main
  .globl func
      .type   func, @function
  func:
  .LFB1:
      .cfi_startproc
      pushq   %rbp
      .cfi_def_cfa_offset 16
      movq    %rsp, %rbp
      .cfi_offset 6, -16
      .cfi_def_cfa_register 6
      movl    %edi, -4(%rbp)
      movl    %esi, %eax
      movb    %al, -8(%rbp)
      leave
      ret
      .cfi_endproc
  .LFE1:
      .size   func, .-func
      .ident  &quot;GCC: (Ubuntu 4.4.1-4ubuntu9) 4.4.1&quot;
      .section    .note.GNU-stack,&quot;&quot;,@progbits
  </code></pre>
  <p>I didn't get the purpose of these.</p>