title: How to generate statically linked executables?
body: <p>I am trying to create a static executable with Rust. I am <em>not</em> trying to statically link a particular library, I am trying to create a executable which <em>does not use dynamic linking at all</em>. I have the following (otherwise working) test:</p>
  
  <pre><code>$ cat hello.rs
  fn main()
      {
      print!("Hello, world!\n");
      }
  $ rustc hello.rs -o hello
  $ file hello
  hello: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV),
   dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, [etc]
  </code></pre>
  
  <p>Note the <code>dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2</code>. Static executables have <code>statically linked</code> instead. (And in my case <code>corrupted section header size</code>, although I would be pleasantly astonished if I can convince Rust to replicate <em>that</em>.)</p>
  
  <p>What options do I need to pass to <code>rustc</code> to get it to generate a actual static executable (for concreteness: one which even <code>file</code> agrees is statically linked).</p>