Skip to content

Commit d96d3a7

Browse files
authored
Merge pull request #670 from tgross35/build-fix
Apply fixes to `build.rs` files
2 parents dae1ac6 + 0f809f6 commit d96d3a7

File tree

3 files changed

+17
-7
lines changed

3 files changed

+17
-7
lines changed

build.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ mod configure;
55
use configure::{configure_f16_f128, Target};
66

77
fn main() {
8-
println!("cargo:rerun-if-changed=build.rs");
8+
println!("cargo::rerun-if-changed=build.rs");
9+
println!("cargo::rerun-if-changed=configure.rs");
10+
911
let target = Target::from_env();
1012
let cwd = env::current_dir().unwrap();
1113

@@ -46,7 +48,7 @@ fn main() {
4648
// These targets have hardware unaligned access support.
4749
println!("cargo::rustc-check-cfg=cfg(feature, values(\"mem-unaligned\"))");
4850
if target.arch.contains("x86_64")
49-
|| target.arch.contains("i686")
51+
|| target.arch.contains("x86")
5052
|| target.arch.contains("aarch64")
5153
|| target.arch.contains("bpf")
5254
{

configure.rs

+6
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
use std::env;
44

5+
#[derive(Debug)]
56
#[allow(dead_code)]
67
pub struct Target {
78
pub triple: String,
@@ -40,6 +41,11 @@ impl Target {
4041
.collect(),
4142
}
4243
}
44+
45+
#[allow(dead_code)]
46+
pub fn has_feature(&self, feature: &str) -> bool {
47+
self.features.iter().any(|f| f == feature)
48+
}
4349
}
4450

4551
/// Configure whether or not `f16` and `f128` support should be enabled.

testcrate/build.rs

+7-5
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ mod builtins_configure {
1414
}
1515

1616
fn main() {
17+
println!("cargo::rerun-if-changed=../configure.rs");
18+
1719
let target = builtins_configure::Target::from_env();
1820
let mut features = HashSet::new();
1921

@@ -27,7 +29,7 @@ fn main() {
2729
|| (target.os == "windows" && target.env == "gnu")
2830
// FIXME(llvm): There is an ABI incompatibility between GCC and Clang on 32-bit x86.
2931
// See <https://github.com/llvm/llvm-project/issues/77401>.
30-
|| target.arch == "i686"
32+
|| target.arch == "x86"
3133
// 32-bit PowerPC and 64-bit LE gets code generated that Qemu cannot handle. See
3234
// <https://github.com/rust-lang/compiler-builtins/pull/606#issuecomment-2105635926>.
3335
|| target.arch == "powerpc"
@@ -41,7 +43,7 @@ fn main() {
4143
features.insert(Feature::NoSysF16F128Convert);
4244
}
4345

44-
if target.arch == "i586" || target.arch == "i686" {
46+
if target.arch == "x86" {
4547
// 32-bit x86 does not have `__fixunstfti`/`__fixtfti` but does have everything else
4648
features.insert(Feature::NoSysF128IntConvert);
4749
// FIXME: 32-bit x86 has a bug in `f128 -> f16` system libraries
@@ -55,7 +57,7 @@ fn main() {
5557
|| target.arch == "powerpc"
5658
|| target.arch == "powerpc64"
5759
|| target.arch == "powerpc64le"
58-
|| target.arch == "i586"
60+
|| (target.arch == "x86" && !target.has_feature("sse"))
5961
|| target.os == "windows"
6062
// Linking says "error: function signature mismatch: __extendhfsf2" and seems to
6163
// think the signature is either `(i32) -> f32` or `(f32) -> f32`. See
@@ -72,11 +74,11 @@ fn main() {
7274
Feature::NoSysF128 => ("no-sys-f128", "using apfloat fallback for f128"),
7375
Feature::NoSysF128IntConvert => (
7476
"no-sys-f128-int-convert",
75-
"using apfloat fallback for f128 to int conversions",
77+
"using apfloat fallback for f128 <-> int conversions",
7678
),
7779
Feature::NoSysF16F128Convert => (
7880
"no-sys-f16-f128-convert",
79-
"skipping using apfloat fallback for f16 <-> f128 conversions",
81+
"using apfloat fallback for f16 <-> f128 conversions",
8082
),
8183
Feature::NoSysF16 => ("no-sys-f16", "using apfloat fallback for f16"),
8284
};

0 commit comments

Comments
 (0)