diff --git a/src/bootstrap/native.rs b/src/bootstrap/native.rs index cfd20b02aaf..ee0eca5d482 100644 --- a/src/bootstrap/native.rs +++ b/src/bootstrap/native.rs @@ -129,6 +129,15 @@ impl Step for Llvm { .define("LLVM_TARGET_ARCH", target.split('-').next().unwrap()) .define("LLVM_DEFAULT_TARGET_TRIPLE", target); + + // This setting makes the LLVM tools link to the dynamic LLVM library, + // which saves both memory during parallel links and overall disk space + // for the tools. We don't distribute any of those tools, so this is + // just a local concern. However, it doesn't work well everywhere. + if target.contains("linux-gnu") || target.contains("apple-darwin") { + cfg.define("LLVM_LINK_LLVM_DYLIB", "ON"); + } + if target.contains("msvc") { cfg.define("LLVM_USE_CRT_DEBUG", "MT"); cfg.define("LLVM_USE_CRT_RELEASE", "MT");