title: printf.c: No such file or directory
body: <p>I tried to make some simple assembly code to print out a number with the assembly. I try to it with a printf function call. Then I run the code I get no output and when I debug it with <code>gdb</code> I get a message that says:</p>
  
  <pre><code>__printf (format=0x601040 "Result: %d") at printf.c:28
  28  printf.c: No such file or directory.
  </code></pre>
  
  <p>I compile it with:</p>
  
  <pre><code>gcc -g -c print.s -o file.o
  </code></pre>
  
  <p>And then linked it with:</p>
  
  <pre><code>gcc file.o -o file
  </code></pre>
  
  <p>When I searched on this problem I found that I should test with</p>
  
  <pre><code>gcc file.o -o file -lc /lib64/ld-linux-x86-64.so.2
  </code></pre>
  
  <p>But the result was the same.</p>
  
  <p>My code</p>
  
  <pre><code>.data
      OUT:    .asciz  "Result: %d"  #The output string
  
  .text
  .global main
  
  main:
      jmp     print
  
  print:
      mov     $OUT,   %rdi    # Our preperation string
      mov     $5,     %rsi    # Value to be printed
      xor     %rax,   %rax    # zero out
      call    printf          # call the function
      #TODO: Jump back
  
  exit:
      mov     $60,    %rax    # Call the exit syscall
      mov     $0,     %rdi    # error code 0
      syscall                 # Interupt kernel and make the syscall
  </code></pre>