mod c {
extern crate cc;
- use std::collections::BTreeMap;
+ use std::collections::{BTreeMap, HashSet};
use std::env;
use std::path::{Path, PathBuf};
("__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" {
// 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);
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);
}