why doesn't LLVM link its dependencies dynamically?

Hi everyone. I’m mainly build the debug versions of lli and opt which are huge and take up to 10 seconds to build. It seems there is no option in configure to allow dynamic linking. Before I try to add it myself, is there a reason why it’s not done?

In addition to the APIs being insufficiently stable for shared libraries to be of much use per se, it invoked pathologically bad performance in some dynamic link editors--startup times greatly exceeding your link times.

— Gordon

OK. I’ve tried using shared libraries for everything except LLVMX86.o, and the build time improvement isn’t as good as I hoped for. On a Dell Precision 390 workstation, the time to rebuild after a one line change in a library is 10 s for static linking and 7.3 s for dynamic linking (building in Eclipse is slower).

One advantage of static linking I haven’t thought about is that only the needed functions need to be loaded, unlike everything for dynamic libraries. The space saving is huge though: 1350MiB vs 723MiB and the IO load is probably greatly reduced.

I’ve added a hackish script that patches LLVM 2.3 to use dynamic libraries if anyone wants it. Just run it after configuring.

make_llvm_use_shared_libs (1.05 KB)

The build times only apply for the libraries, opt, and lli. I’ve disabled the rest, so if you’re building everything, the time saved should be more.