[LLVMdev] Why LLVM libraries are static?

Chris Lattner sabre at nondot.org
Wed Mar 1 09:32:59 PST 2006


On Wed, 1 Mar 2006, Vladimir Prus wrote:
> Is there any reason why after "./configure; make" all LLVM libraries are .a
> files, and not .so files?

Initially we had all of the LLVM libraries be .so files.  The problem with 
this is that it was *really* slow to start up an LLVM program (e.g. llc or 
opt) that is set up like this.

However, if you want to, you should be able to build the libraries as 
shared objects, by adding these options in the makefile for the library:

SHARED_LIBRARY = 1
LOADABLE_MODULE = 1

> The problem with .a files is that if I make a plugin, say code generator, it
> should link in pretty large LLVM libraries. If libraries were shared, this
> would not be required.

True.  For a tool where you aren't starting up and shutting down a lot 
(e.g. an IDE with an integrated compiler, or a long-living tool that uses 
a JIT), using shared objects makes sense.

> Or I just did not notice some option to configure?

It isn't THAT easy, but you should be able to do it by changing the 
makefiles as above.

-Chris

-- 
http://nondot.org/sabre/
http://llvm.org/




More information about the llvm-dev mailing list