]> git.proxmox.com Git - rustc.git/blobdiff - vendor/compiler_builtins/build.rs
New upstream version 1.55.0+dfsg1
[rustc.git] / vendor / compiler_builtins / build.rs
index f0617b6e92a10e77ccb1d7711487be0d8a889603..d4cfe0e1c2b3ab526a44aeb096e0816a12e4daef 100644 (file)
@@ -84,7 +84,7 @@ fn main() {
 mod c {
     extern crate cc;
 
-    use std::collections::BTreeMap;
+    use std::collections::{BTreeMap, HashSet};
     use std::env;
     use std::path::{Path, PathBuf};
 
@@ -419,23 +419,18 @@ mod c {
                 ("__floatunsitf", "floatunsitf.c"),
                 ("__trunctfdf2", "trunctfdf2.c"),
                 ("__trunctfsf2", "trunctfsf2.c"),
+                ("__addtf3", "addtf3.c"),
+                ("__multf3", "multf3.c"),
+                ("__subtf3", "subtf3.c"),
+                ("__divtf3", "divtf3.c"),
+                ("__powitf2", "powitf2.c"),
+                ("__fe_getround", "fp_mode.c"),
+                ("__fe_raise_inexact", "fp_mode.c"),
             ]);
 
             if target_os != "windows" {
                 sources.extend(&[("__multc3", "multc3.c")]);
             }
-
-            if target_env == "musl" {
-                sources.extend(&[
-                    ("__addtf3", "addtf3.c"),
-                    ("__multf3", "multf3.c"),
-                    ("__subtf3", "subtf3.c"),
-                    ("__divtf3", "divtf3.c"),
-                    ("__powitf2", "powitf2.c"),
-                    ("__fe_getround", "fp_mode.c"),
-                    ("__fe_raise_inexact", "fp_mode.c"),
-                ]);
-            }
         }
 
         if target_arch == "mips" {
@@ -496,8 +491,9 @@ mod c {
 
         // Include out-of-line atomics for aarch64, which are all generated by supplying different
         // sets of flags to the same source file.
+        // Note: Out-of-line aarch64 atomics are not supported by the msvc toolchain (#430).
         let src_dir = root.join("lib/builtins");
-        if target_arch == "aarch64" {
+        if target_arch == "aarch64" && target_env != "msvc" {
             // See below for why we're building these as separate libraries.
             build_aarch64_out_of_line_atomics_libraries(&src_dir, cfg);
 
@@ -505,10 +501,13 @@ mod c {
             sources.extend(&[("__aarch64_have_lse_atomics", "cpu_model.c")]);
         }
 
+        let mut added_sources = HashSet::new();
         for (sym, src) in sources.map.iter() {
             let src = src_dir.join(src);
-            cfg.file(&src);
-            println!("cargo:rerun-if-changed={}", src.display());
+            if added_sources.insert(src.clone()) {
+                cfg.file(&src);
+                println!("cargo:rerun-if-changed={}", src.display());
+            }
             println!("cargo:rustc-cfg={}=\"optimized-c\"", sym);
         }