Skip to content

Commit 1636a2c

Browse files
committed
Link LLVM tools dynamically
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`.
1 parent 2a6828e commit 1636a2c

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/bootstrap/native.rs

+1
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ impl Step for Llvm {
125125
.define("WITH_POLLY", "OFF")
126126
.define("LLVM_ENABLE_TERMINFO", "OFF")
127127
.define("LLVM_ENABLE_LIBEDIT", "OFF")
128+
.define("LLVM_LINK_LLVM_DYLIB", "ON")
128129
.define("LLVM_PARALLEL_COMPILE_JOBS", build.jobs().to_string())
129130
.define("LLVM_TARGET_ARCH", target.split('-').next().unwrap())
130131
.define("LLVM_DEFAULT_TARGET_TRIPLE", target);

0 commit comments

Comments
 (0)