title: Why does GDB say that this address is being called
body: <p>I made a very simple C program to print &quot;hello world&quot; to the screen. But in the disassembly, I noticed something strange.</p>
  <p>test.c:</p>
  <pre><code>#include &lt;unistd.h&gt;
  #include &lt;stdlib.h&gt;
  
  int main() {
      write(1, &quot;hello, world\n&quot;, 14);
      exit(0);
  }
  </code></pre>
  <p>First, I compile with <code>gcc ./test.c</code> and get the binary <code>a.out</code>. Perfectly normal.</p>
  <p>Then I launch gdb with <code>gdb ./a.out</code> and set the first breakpoint to <code>_start</code> with <code>b _start</code></p>
  <p>I type <code>r</code> and dissasemble the <code>_start</code> function with <code>disass</code></p>
  <p>My start function looks like this:</p>
  <pre><code>Dump of assembler code for function _start:
  =&gt; 0x0000555555555050 &lt;+0&gt;:     endbr64 
     0x0000555555555054 &lt;+4&gt;:     xor    %ebp,%ebp
     0x0000555555555056 &lt;+6&gt;:     mov    %rdx,%r9
     0x0000555555555059 &lt;+9&gt;:     pop    %rsi
     0x000055555555505a &lt;+10&gt;:    mov    %rsp,%rdx
     0x000055555555505d &lt;+13&gt;:    and    $0xfffffffffffffff0,%rsp
     0x0000555555555061 &lt;+17&gt;:    push   %rax
     0x0000555555555062 &lt;+18&gt;:    push   %rsp
     0x0000555555555063 &lt;+19&gt;:    lea    0x176(%rip),%r8        # 0x5555555551e0 &lt;__libc_csu_fini&gt;
     0x000055555555506a &lt;+26&gt;:    lea    0xff(%rip),%rcx        # 0x555555555170 &lt;__libc_csu_init&gt;
     0x0000555555555071 &lt;+33&gt;:    lea    0xd1(%rip),%rdi        # 0x555555555149 &lt;main&gt;
     0x0000555555555078 &lt;+40&gt;:    call   *0x2f62(%rip)        # 0x555555557fe0
     0x000055555555507e &lt;+46&gt;:    hlt
  </code></pre>
  <p>In _start+40 we're calling <code>*0x2f62(%rip)</code>, but not main? Even stranger, I type <code>x/20i 0x555555557fe0</code> to disassemble this mystery address and get:</p>
  <pre><code>   0x555555557fe0:      rex push %rbx
     0x555555557fe2:      fdiv   %st,%st(7)
     0x555555557fe4:      (bad)  
     0x555555557fe5:      jg     0x555555557fe7
     0x555555557fe7:      add    %al,(%rax)
     0x555555557fe9:      add    %al,(%rax)
     0x555555557feb:      add    %al,(%rax)
     0x555555557fed:      add    %al,(%rax)
     0x555555557fef:      add    %al,(%rax)
     0x555555557ff1:      add    %al,(%rax)
     0x555555557ff3:      add    %al,(%rax)
     0x555555557ff5:      add    %al,(%rax)
     0x555555557ff7:      add    %al,-0x30(%rax)
     0x555555557ffa:      (bad)  
     0x555555557ffc:      (bad)  
     0x555555557ffd:      jg     0x555555557fff
     0x555555557fff:      add    %bh,%al
     0x555555558001:      cmp    $0x0,%eax
     0x555555558006:      add    %al,(%rax)
     0x555555558008:      movabs 0xd000007ffff7ffe2,%al
  </code></pre>
  <p>how odd. I typed <code>b *0x0000555555555078</code>, to set a breakpoint at where <code>_start</code> calls this, and the an <code>si</code>, but instead of being at <code>0x555555557fe0</code>, I wound up at <code>0x00007ffff7dc5340 in __libc_start_main_impl () from /usr/lib/libc.so.6</code>.</p>
  <p>Can anyone explain to me what's going on here? Is this a common thing, or is my GDB acting up?</p>