about summary refs log tree commit diff
path: root/src/bootstrap/native.rs
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2017-02-14 14:30:39 -0800
committerAlex Crichton <alex@alexcrichton.com>2017-02-15 19:36:29 -0800
commitc02c44db724ddf63e6d5a3725dd5cd7f8c344052 (patch)
treecce41c52be930b74ec3763a55b47880ebcc061da /src/bootstrap/native.rs
parent48bc08247a7b4a5579437df54ca3f4a3fb25ce8d (diff)
downloadrust-c02c44db724ddf63e6d5a3725dd5cd7f8c344052.tar.gz
rust-c02c44db724ddf63e6d5a3725dd5cd7f8c344052.zip
rustc: Link statically to the MSVCRT
This commit changes all MSVC rustc binaries to be compiled with
`-C target-feature=+crt-static` to link statically against the MSVCRT instead of
dynamically (as it does today). This also necessitates compiling LLVM in a
different fashion, ensuring it's compiled with `/MT` instead of `/MD`.

cc #37406
Diffstat (limited to 'src/bootstrap/native.rs')
-rw-r--r--src/bootstrap/native.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/bootstrap/native.rs b/src/bootstrap/native.rs
index 21fc61cc814..f16fc2092f6 100644
--- a/src/bootstrap/native.rs
+++ b/src/bootstrap/native.rs
@@ -99,6 +99,12 @@ pub fn llvm(build: &Build, target: &str) {
        .define("LLVM_TARGET_ARCH", target.split('-').next().unwrap())
        .define("LLVM_DEFAULT_TARGET_TRIPLE", target);
 
+    if target.contains("msvc") {
+        cfg.define("LLVM_USE_CRT_DEBUG", "MT");
+        cfg.define("LLVM_USE_CRT_RELEASE", "MT");
+        cfg.define("LLVM_USE_CRT_RELWITHDEBINFO", "MT");
+    }
+
     if target.starts_with("i686") {
         cfg.define("LLVM_BUILD_32_BITS", "ON");
     }