]> git.lizzy.rs Git - rust.git/commitdiff
rustc: Link statically to the MSVCRT
authorAlex Crichton <alex@alexcrichton.com>
Tue, 14 Feb 2017 22:30:39 +0000 (14:30 -0800)
committerAlex Crichton <alex@alexcrichton.com>
Thu, 16 Feb 2017 03:36:29 +0000 (19:36 -0800)
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

src/bootstrap/bin/rustc.rs
src/bootstrap/native.rs
src/rustllvm/llvm-auto-clean-trigger

index 90fd31ecbdd732d963b4ccfce6b8478418a32292..62e476bd737d3f62c02d59de2cc168021392b640 100644 (file)
@@ -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 {
index 21fc61cc81484da74ba0eafa9b76ed8ba2e14be8..f16fc2092f6161d639c7cca890f0cd87d93cba8b 100644 (file)
@@ -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");
     }
index b74f491385820051170dfecf3b9c3b0acb880396..ab36e9a2c2b20f0ee888b56b9e929d9637ca126a 100644 (file)
@@ -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