Skip to content

Commit 96bc62e

Browse files
committed
Support long double intrinsics in any aarch64 linux
Expands the support added in rust-lang#377 from just musl to any linux. Also checks for and avoids adding duplicate sources. Fixes rust-lang#428
1 parent f26cf72 commit 96bc62e

File tree

1 file changed

+13
-15
lines changed

1 file changed

+13
-15
lines changed

build.rs

+13-15
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ fn main() {
8484
mod c {
8585
extern crate cc;
8686

87-
use std::collections::BTreeMap;
87+
use std::collections::{BTreeMap, HashSet};
8888
use std::env;
8989
use std::path::{Path, PathBuf};
9090

@@ -419,23 +419,18 @@ mod c {
419419
("__floatunsitf", "floatunsitf.c"),
420420
("__trunctfdf2", "trunctfdf2.c"),
421421
("__trunctfsf2", "trunctfsf2.c"),
422+
("__addtf3", "addtf3.c"),
423+
("__multf3", "multf3.c"),
424+
("__subtf3", "subtf3.c"),
425+
("__divtf3", "divtf3.c"),
426+
("__powitf2", "powitf2.c"),
427+
("__fe_getround", "fp_mode.c"),
428+
("__fe_raise_inexact", "fp_mode.c"),
422429
]);
423430

424431
if target_os != "windows" {
425432
sources.extend(&[("__multc3", "multc3.c")]);
426433
}
427-
428-
if target_env == "musl" {
429-
sources.extend(&[
430-
("__addtf3", "addtf3.c"),
431-
("__multf3", "multf3.c"),
432-
("__subtf3", "subtf3.c"),
433-
("__divtf3", "divtf3.c"),
434-
("__powitf2", "powitf2.c"),
435-
("__fe_getround", "fp_mode.c"),
436-
("__fe_raise_inexact", "fp_mode.c"),
437-
]);
438-
}
439434
}
440435

441436
if target_arch == "mips" {
@@ -505,10 +500,13 @@ mod c {
505500
sources.extend(&[("__aarch64_have_lse_atomics", "cpu_model.c")]);
506501
}
507502

503+
let mut added_sources = HashSet::new();
508504
for (sym, src) in sources.map.iter() {
509505
let src = src_dir.join(src);
510-
cfg.file(&src);
511-
println!("cargo:rerun-if-changed={}", src.display());
506+
if added_sources.insert(src.clone()) {
507+
cfg.file(&src);
508+
println!("cargo:rerun-if-changed={}", src.display());
509+
}
512510
println!("cargo:rustc-cfg={}=\"optimized-c\"", sym);
513511
}
514512

0 commit comments

Comments
 (0)