[LLVMdev] Using thin archives when building llvm

Rafael Espíndola rafael.espindola at gmail.com
Fri Jul 17 10:11:48 PDT 2015


> FWIW, i’d more than welcome a patch to get this in to cmake.
>
> Chris added a flag (LLVM_OPTIMIZED_TBLGEN) to build an optimized tblgen and use that in the regular build.  I’d be happy to see a similar flag used to have that step build an llvm-ar used by the rest of compilation to use thin archives.  At least until we start shipping this.
>
> I’m happy to propose a patch or help test one if you have one in future.

I normally locally install a recent trunk, so for me
CMAKE_CXX_CREATE_STATIC_LIBRARY does the job. Given that, I am
probably not the best one to write patch for building llvm-ar and then
use it.

Also, llvm-ar depends on target (to parse inline asm), so quite a few
.a files will still be built with the old ar.

I think the only linkers that support thin archives are
* bfd ld
* gold
* The new COFF lld

So far I have really only tested with gold (still doing windowns setup
to test the new lld).

Last but not least, the thin archive is in gnu format. If adding
support to OS X (lld or ld64), it might be interesting to experiment
with a thin BFD format (the symbol table there has offsets into the
symbol name table, making it a bit faster to use with unix .a
semantics).

Cheers,
Rafael




More information about the llvm-dev mailing list