On 17 July 2015 at 07:19, Brad King <brad.king at kitware.com> wrote:> On 07/15/2015 09:00 PM, Rafael Espíndola wrote: >> I have just committed support to llvm-ar for creating thin archives. >> The idea of thin archives is that they contain just the symbol table >> and the path to find the original .o files. > > Neat! Is this expected to be used only for non-installed archives?Yes, the idea is to speed up a regular development build.>> Is there any way to do that with cmake without having to have a hacked >> llvm-ar? All that is needed is for cmake to run >> >> .../llvm-ar cqT foo.a .... >> >> instead of >> >> .../llvm-ar cq foo.a .... > > CMake has undocumented variables set by the Modules/Platform/* > files to specify the rules for creating archives. These are: > > CMAKE_<LANG>_ARCHIVE_{CREATE,APPEND,FINISH}I went with this one on my run-cmake script, thanks. Cheers, Rafael
> On Jul 17, 2015, at 7:49 AM, Rafael Espíndola <rafael.espindola at gmail.com> wrote: > > On 17 July 2015 at 07:19, Brad King <brad.king at kitware.com> wrote: >> On 07/15/2015 09:00 PM, Rafael Espíndola wrote: >>> I have just committed support to llvm-ar for creating thin archives. >>> The idea of thin archives is that they contain just the symbol table >>> and the path to find the original .o files. >> >> Neat! Is this expected to be used only for non-installed archives? > > Yes, the idea is to speed up a regular development build. > >>> Is there any way to do that with cmake without having to have a hacked >>> llvm-ar? All that is needed is for cmake to run >>> >>> .../llvm-ar cqT foo.a .... >>> >>> instead of >>> >>> .../llvm-ar cq foo.a .... >> >> CMake has undocumented variables set by the Modules/Platform/* >> files to specify the rules for creating archives. These are: >> >> CMAKE_<LANG>_ARCHIVE_{CREATE,APPEND,FINISH} > > I went with this one on my run-cmake script, thanks.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. Cheers, Pete> > Cheers, > Rafael > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
> 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