title: What is <.got> section in ELF?
body: <p>As far as I know, <code>PLT</code> and <code>GOT</code> are the section for handling dynamic linked function.    </p>
  
  <p>If code calls <code>printf</code> which is libc's function,<br>
   1. Firstly it calls <code>PLT</code> to get <code>printf</code>'s address.<br>
   2. And write this address into <code>GOT</code> section.<br>
   3. From second call, code uses the function written in <code>GOT</code>.  </p>
  
  <p>As I look into ELF binary closely,<br>
  - I found section <code>PLT</code>'s name in ELF is <code>&lt;.plt&gt;</code>.<br>
  - And section <code>GOT</code>'s name in ELF is <code>&lt;.got.plt&gt;</code>.  </p>
  
  <p>But ... There was also <code>&lt;.got&gt;</code> section in ELF.<br>
    And I could not understand how this section is used.  </p>
  
  <p><br>
  <br></p>
  
  <p><strong>Q. What is usage of <code>&lt;.got&gt;</code> section?</strong><br>
  <strong>And what's difference between <code>&lt;.got&gt;</code> and <code>&lt;.got.plt&gt;</code> section?</strong>  </p>
  
  <p><br>
  <br></p>
  
  <p><em>PS 1.  This <code>&lt;.got&gt;</code> section was very tiny, (It only holds 4byte in my sample binary.)</em><br>
  <em>And here I attach IDA view of <code>&lt;.got&gt;</code> section:</em>  </p>
  
  <pre><code>.got:08049FFC ; ===========================================================================
  .got:08049FFC
  .got:08049FFC ; Segment type: Pure data
  .got:08049FFC ; Segment permissions: Read/Write
  .got:08049FFC _got            segment dword public 'DATA' use32
  .got:08049FFC                 assume cs:_got
  .got:08049FFC                 ;org 8049FFCh
  .got:08049FFC __gmon_start___ptr dd offset __imp___gmon_start__
  .got:08049FFC                                         ; DATA XREF: _init_proc+F↑r
  .got:08049FFC                                         ; __gmon_start__↑r
  .got:08049FFC _got            ends
  .got:08049FFC
  </code></pre>
  
  <p><br></p>
  
  <p><em>PS2. I also checked <a href="https://stackoverflow.com/questions/11676472/what-is-the-difference-between-got-and-got-plt-section">here</a>, but the answer was not enough for me to understand the usage of &lt;.got> section.</em>  </p>