about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2017-02-17 22:12:00 +0000
committerbors <bors@rust-lang.org>2017-02-17 22:12:00 +0000
commit23a0c2657ab917e80436816906183a9e2f4aa551 (patch)
treef65ce0e0baeabe38d4e3ba213842b580cff960ea
parent536a900c471dffad6e33766a2866889000fbfa75 (diff)
parentc02c44db724ddf63e6d5a3725dd5cd7f8c344052 (diff)
downloadrust-23a0c2657ab917e80436816906183a9e2f4aa551.tar.gz
rust-23a0c2657ab917e80436816906183a9e2f4aa551.zip
Auto merge of #39837 - alexcrichton:llvm-crt-static, r=brson
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
-rw-r--r--src/bootstrap/bin/rustc.rs5
-rw-r--r--src/bootstrap/native.rs6
-rw-r--r--src/rustllvm/llvm-auto-clean-trigger2
3 files changed, 12 insertions, 1 deletions
diff --git a/src/bootstrap/bin/rustc.rs b/src/bootstrap/bin/rustc.rs
index 90fd31ecbdd..62e476bd737 100644
--- a/src/bootstrap/bin/rustc.rs
+++ b/src/bootstrap/bin/rustc.rs
@@ -205,6 +205,11 @@ fn main() {
                 }
             }
         }
+
+        if target.contains("pc-windows-msvc") {
+            cmd.arg("-Z").arg("unstable-options");
+            cmd.arg("-C").arg("target-feature=+crt-static");
+        }
     }
 
     if verbose > 1 {
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");
     }
diff --git a/src/rustllvm/llvm-auto-clean-trigger b/src/rustllvm/llvm-auto-clean-trigger
index b74f4913858..ab36e9a2c2b 100644
--- a/src/rustllvm/llvm-auto-clean-trigger
+++ b/src/rustllvm/llvm-auto-clean-trigger
@@ -1,4 +1,4 @@
 # If this file is modified, then llvm will be forcibly cleaned and then rebuilt.
 # The actual contents of this file do not matter, but to trigger a change on the
 # build bots then the contents should be changed so git updates the mtime.
-2016-12-19
+2017-02-15