]> git.lizzy.rs Git - rust.git/commitdiff
Link LLVM tools dynamically
authorJosh Stone <jistone@redhat.com>
Mon, 31 Jul 2017 22:34:05 +0000 (15:34 -0700)
committerJosh Stone <jistone@redhat.com>
Mon, 31 Jul 2017 22:34:05 +0000 (15:34 -0700)
Set `LLVM_LINK_LLVM_DYLIB=ON` -- "If enabled, tools will be linked with
the libLLVM shared library."  Rust doesn't ship any of the LLVM tools,
and only needs a few at all for some test cases, so statically linking
the tools is just a waste of space.  I've also had memory issues on
slower machines with LLVM debuginfo enabled, when several tools start
linking in parallel consuming several GBs each.

With the default configuration, `build/x86_64-unknown-linux-gnu/llvm`
was 1.5GB before, now down to 731MB.  The difference is more drastic
with `--enable-llvm-release-debuginfo`, from 28GB to "only" 13GB.

This does not change the linking behavior of `rustc_llvm`.

src/bootstrap/native.rs

index cfd20b02aaf6b70261db593bdc25c49e24a06d55..595f90be1dd6a8fcfe9a7666123a5f878882177e 100644 (file)
@@ -125,6 +125,7 @@ fn run(self, builder: &Builder) {
            .define("WITH_POLLY", "OFF")
            .define("LLVM_ENABLE_TERMINFO", "OFF")
            .define("LLVM_ENABLE_LIBEDIT", "OFF")
+           .define("LLVM_LINK_LLVM_DYLIB", "ON")
            .define("LLVM_PARALLEL_COMPILE_JOBS", build.jobs().to_string())
            .define("LLVM_TARGET_ARCH", target.split('-').next().unwrap())
            .define("LLVM_DEFAULT_TARGET_TRIPLE", target);