title: Read plt section of ELF binary and print function virtual address
body: <p>I want to read .plt section of an ELF binary and get all the virtual addresses of external functions. </p>
  
  <pre><code>Disassembly of section .plt:
  
  0000000000400400 &lt;puts@plt-0x10&gt;:
    400400:       ff 35 02 0c 20 00       pushq  0x200c02(%rip)        # 601008 &lt;_GLOBAL_OFFSET_TABLE_+0x8&gt;
    400406:       ff 25 04 0c 20 00       jmpq   *0x200c04(%rip)        # 601010 &lt;_GLOBAL_OFFSET_TABLE_+0x10&gt;
    40040c:       0f 1f 40 00             nopl   0x0(%rax)
  
  0000000000400410 &lt;puts@plt&gt;:
    400410:       ff 25 02 0c 20 00       jmpq   *0x200c02(%rip)        # 601018 &lt;_GLOBAL_OFFSET_TABLE_+0x18&gt;
    400416:       68 00 00 00 00          pushq  $0x0
    40041b:       e9 e0 ff ff ff          jmpq   400400 &lt;_init+0x20&gt;
  
  0000000000400420 &lt;__libc_start_main@plt&gt;:
    400420:       ff 25 fa 0b 20 00       jmpq   *0x200bfa(%rip)        # 601020 &lt;_GLOBAL_OFFSET_TABLE_+0x20&gt;
    400426:       68 01 00 00 00          pushq  $0x1
    40042b:       e9 d0 ff ff ff          jmpq   400400 &lt;_init+0x20&gt;
  
  0000000000400430 &lt;__gmon_start__@plt&gt;:
    400430:       ff 25 f2 0b 20 00       jmpq   *0x200bf2(%rip)        # 601028 &lt;_GLOBAL_OFFSET_TABLE_+0x28&gt;
    400436:       68 02 00 00 00          pushq  $0x2
    40043b:       e9 c0 ff ff ff          jmpq   400400 &lt;_init+0x20&gt;
  </code></pre>
  
  <p>For example, <code>0x400410</code> and the function name <code>puts@plt</code> and so on. I've tried to read <code>REL_PLT</code> section of ELF binary. But I get the address <code>0x601108</code> for PLT entry <code>0x400410</code> which is from Global Offset Table. How can I get the virtual addresses of plt entries?</p>
  
  <p><strong>EDIT</strong>: It turned out I'm reading <code>got.plt</code> section. How can I read just <code>.plt</code> section using readelf?</p>