title: How can I use llvm-ar generated archive file?
body: <p><code>llvm-ar</code> archives several LLVM bitcode files into a single archive library that can be linked into a program. The archive operation works as expected. Aslo, it is possible to use <code>llvm-nm</code> to show all the symbols in the generated archive.</p>
  
  <p>However, I noticed the generated archive can not be used by the other standard llvm tools, for example, <code>llc</code>, <code>lli</code> and <code>llvm-link</code> directly.</p>
  
  <p>In order to use the generated archived file, I have to extract all the bitcode files from the archived file and then use them directly by <code>llc</code>. </p>
  
  <p>Questions:</p>
  
  <ol>
  <li><p>Is there some more elegant or efficient way to use the generated archived file by <code>llvm-ar</code>?</p></li>
  <li><p>Could clang use bitcode archived file directly as below:</p></li>
  </ol>
  
  <pre><code>// assumes hello.bc is valid bitcode file and it is built successfully
  clang-3.8  -o main main.c hello.bc
  
  // ar hello.bc into lib libhello.bca
  llvm-ar-3.8 rcs libhello.bca hello.bc
  
  llvm-nm libhello.bca // has below output
  
     hello.bc:
     ---------------- T outupt
                      U puts
  
  clang-3.8 -o main main.c libhello.bca // has below error
  
    libhello.bca: error adding symbols: File format not recognized
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
  </code></pre>