title: Linking Linux x86-64 assembly hello world program with ld fails
body: <p>I've been toying around with x86 64 bit assembly on linux recently and after compiling a seemingly simple program I am left scratching my head :P</p>
  
  <p>Although I compile and link it throws no errors and produces a linux ELF
  When i try to run it I get:</p>
  
  <pre><code>.:[ h4unt3r@sp3ctr4l-h0st asm ]:.
  #(0)&gt; ./hello 
  bash: ./hello: No such file or directory
  </code></pre>
  
  <p>I assume its producing an invalid ELF file which is why it reports hello is not there even though it IS. Not sure why-- I'll probably keep playing around with it, just curious if this can be solved the easy way ^_^</p>
  
  <p>Here is my compile / link command line:</p>
  
  <pre><code>nasm -f elf64 hello.s -g
  ld -o hello hello.o -lc
  </code></pre>
  
  <p>Here is the code:</p>
  
  <pre><code>section .data
      msg: db "Hello, world!",0xa,0
  
  section .text
      extern printf
      global main
  
  main:
      push rbp
      mov rbp, rsp
  
      mov rdi, msg
      xor rax, rax
      call printf
      xor rax, rax
  
      pop rbp
      ret
  </code></pre>
  
  <p>Edit -- I do not want to use gcc :)</p>