[LLVMdev] Using thin archives when building llvm

Brad King brad.king at kitware.com
Fri Jul 17 07:19:52 PDT 2015


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?

> 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}

for creating, appending to, and finishing an archive.  For
tools/platforms that do not support separate steps we also
have:

 CMAKE_<LANG>_CREATE_STATIC_LIBRARY

One or both of these may need to be updated to handle this.
However, if this should be done only for a subset of archives
then it needs to be optional on a per-target bases.  For this
you may be able to just use the STATIC_LIBRARY_FLAGS property:

 http://www.cmake.org/cmake/help/v3.3/prop_tgt/STATIC_LIBRARY_FLAGS.html

I don't recall off the top of my head though where the flags
will be placed for "ar" and whether they will apply on all
three archiving steps.  Hopefully the above is enough info
to get you started.

-Brad





More information about the llvm-dev mailing list