[LLVMdev] Long-Term Support for LLVM Projects Extension to Build System?

David Chisnall David.Chisnall at cl.cam.ac.uk
Mon Jun 22 00:28:02 PDT 2015


On 22 Jun 2015, at 02:42, Dan Liew <dan at su-root.co.uk> wrote:
> 
> AFAIK the exported CMake targets only work with the static LLVM
> libraries right now. The intention is that user's of LLVM should use
> the llvm_map_components_to_libnames() function in CMake. Right now
> that returns the names of the static library targets. In principle I
> suppose it could be modified to return the shared library target
> instead if a shared build was done. But there are a few issues to
> consider here:
> 
> * When LLVM is built it possible to pick what components go into the
> shared library which means in some cases
> ``llvm_map_components_to_libnames()`` would not work as intended if
> just returns the LLVM shared library target name.
> * A user of LLVM may want the ability to pick the static libraries
> even though the shared libraries were built.
> * In the shared library the C++ symbols hidden so we would need to add
> an option to disable this behaviour.
> 
> Here's what I'd like to suggest:
> 
> - Modify ``llvm_map_components_to_libnames()`` to take an optional
> keyword which is either STATIC or SHARED. To avoid ambiguity this
> means we cannot have a component called "STATIC" or "SHARED", I don't
> imagine this would ever happen in practice. So the signature would
> look like this
> 
> llvm_map_components_to_libnames(OUTPUTVAR [STATIC|SHARED] component0 ...)
> 
> 
> - If set to static the static library names will be returned if the
> components exists, otherwise emit an error message.
> - If SHARED is specified CMake will check that the requested
> components were added to the shared library when it was built. For
> this to work the names of the components will need to be written into
> LLVMConfig.cmake. If all the components requested are supposed to be
> in the shared library then return the shared library target, otherwise
> emit an error message (this includes the case where the shared library
> was not built).
> - If STATIC or SHARED is not specified use STATIC so as to not break
> the interface for existing users of llvm_map_components_to_libnames().
> - Switch C++ symbol hiding in the shared library off by default.
> 
> Thoughts?

This all sounds great to me.  That said, my use case is quite unusual: I want a single debug build of LLVM and a single release build on a shared file server so that students can link things against a debug build without ending up with a few hundred MBs of object code in their home directories for each exercise and hitting quota issues.  I suspect that this isn’t a problem that doesn’t affect most other people.

David





More information about the llvm-dev mailing list