title: Compile a library with clang (from LLVM byte code)
body: <p>I have a library foo in foo.c:</p>
  
  <pre><code>int foo() { return 0; }
  </code></pre>
  
  <p>I want to compile to a static object<code>foo.o</code>. When I do it directly like the following, this works.</p>
  
  <pre><code>clang -c foo.c -o foo.o
  </code></pre>
  
  <p>However, I want to go via the llvm byte code:</p>
  
  <pre><code>clang -emit-llvm -c foo.c  # Compile to LLVM byte code
  clang foo.bc -o foo.o      # Compile LLVM byte code to native
  </code></pre>
  
  <p>The last command fails with following error message:</p>
  
  <pre><code>/usr/lib/gcc/x86_64-linux-gnu/5.4.0/../../../x86_64-linux-gnu/crt1.o: In function `_start':
  (.text+0x20): undefined reference to `main'
  clang-3.9: error: linker command failed with exit code 1 (use -v to see invocation)
  </code></pre>
  
  <p>I know that there is no main, which is expected since I compile a library. How to compile that library from LLVM byte code?</p>